RocketSimApp icon indicating copy to clipboard operation
RocketSimApp copied to clipboard

SVGLength Crash at first launch

Open emrdgrmnci opened this issue 1 year ago • 2 comments

Describe the bug The app crashes on first launch after adding the #DEBUG code from the RocketSim Simulator app to track network requests. The error message indicates an issue with determining PPI values for the current device, which affects SVG rendering.

To Reproduce Steps to reproduce the behavior:

  1. Add the #DEBUG code from RocketSim Simulator app to the project
  2. Build and run the app
  3. App crashes immediately on launch

Error Message: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot determine the PPI values for current device; returning 0.0f - hopefully this will crash your code (you CANNOT run SVG's that use CM/IN/MM etc until you fix this)'

Expected behavior The app should launch successfully with the added debug code for tracking network requests.

Desktop (please complete the following information):

  • OS: iOS, MacOS
  • Version: 17.4, Sonoma 14.4.1

emrdgrmnci avatar Jul 05 '24 07:07 emrdgrmnci

@emrdgrmnci are you sure this crash doesn't happen when you disable RocketSim Connect?

I can see RocketSim's swizzle methods, but they shouldn't influence any behavior. For full clarity: the error message:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot determine the PPI values for current device; returning 0.0f - hopefully this will crash your code (you CANNOT run SVG's that use CM/IN/MM etc until you fix this)'

Is not from RocketSim Connect and somewhere else in your code.

AvdLee avatar Jul 05 '24 12:07 AvdLee

Yeah, I know it doesn't look like related but when I add the RocketSim Connect setup code it directly crashing at first launch of the app and affecting SVGLength finding device size ridiculously.

emrdgrmnci avatar Jul 05 '24 12:07 emrdgrmnci

@emrdgrmnci is this still an issue? And if so, do you think we can recreate it in a isolated Xcode project so I can reproduce it locally?

AvdLee avatar Sep 16 '24 09:09 AvdLee

Yes! But I needed to call loadRocketSimConnect method from func application(_ application: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) instead of func applicationDidFinishLaunching(_ aNotification: Notification) as referred in the Network Monitor documentation. I think for the UIKit side loadRocketSimConnect should only be called from func applicationDidFinishLaunching

emrdgrmnci avatar Sep 16 '24 12:09 emrdgrmnci