SVGLength Crash at first launch
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:
- Add the #DEBUG code from RocketSim Simulator app to the project
- Build and run the app
- 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 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.
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 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?
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