Keselme
Keselme

Reputation: 4239

App crashes immediately on iOS Simulator with os version 15 and up

I'm trying to run an app on iOS simulator with os version of 15.2 the app crashes immediately. I also trying running on a Simulator with os version of 13.7 and everything works. I would also like to point out that testing on a real device with os 15.0.1 works fine it's only the simulators with os of 15 and above are the problematic once. (I didn't try it on os 14 though).

The exception that I see is:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL URLByAppendingPathExtension:]: component, components, or pathExtension cannot be nil.'

I also see in the logs the following error

2022-01-23 22:17:56.420470+0200 ********[99005:556023] [Assert] failed to get type for URL (file:///Users/**********/Library/Developer/CoreSimulator/Devices/70A52D90-4707-4CF8-9804-D2F030583E8D/data/Containers/Data/Application/97394EA4-CEB7-45FC-B624-41389A934FC0/Library/MyDocument.md) error: The file “MyDocument.md” couldn’t be opened because there is no such file.

What is that MyDocument.md that it's looking for?

Here's the callstack as well:

    0   CoreFoundation                      0x000000010b5f6ba4 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00000001097f4be7 objc_exception_throw + 48
    2   Foundation                          0x00000001092a2fe8 -[NSURL(NSURLPathUtilities) URLByDeletingPathExtension] + 0
    3   UIKitCore                           0x000000011ae3d46b -[UIDocument saveToURL:forSaveOperation:completionHandler:] + 270
    4   FLOTelematicsSDK                    0x0000000109fb4b75 _Z35FLOEncryption_streamBlockEnryptDataP20FLOEncryptionContext17Uint32PointerData + 11764
    5   FLOTelematicsSDK                    0x0000000109fb65e1 _Z35FLOEncryption_streamBlockEnryptDataP20FLOEncryptionContext17Uint32PointerData + 18528
    6   libdispatch.dylib                   0x0000000109a0565a _dispatch_call_block_and_release + 12
    7   libdispatch.dylib                   0x0000000109a0683a _dispatch_client_callout + 8
    8   libdispatch.dylib                   0x0000000109a13c88 _dispatch_main_queue_callback_4CF + 1075
    9   CoreFoundation                      0x000000010b56484d __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    10  CoreFoundation                      0x000000010b55f0aa __CFRunLoopRun + 2772
    11  CoreFoundation                      0x000000010b55e0f3 CFRunLoopRunSpecific + 567
    12  GraphicsServices                    0x000000010ed0dcd3 GSEventRunModal + 139
    13  UIKitCore                           0x000000011b548f42 -[UIApplication _run] + 928
    14  UIKitCore                           0x000000011b54db5e UIApplicationMain + 101
    15  SDKSandbox                          0x000000010081b60b main + 80
    16  dyld                                0x0000000108fadee9 start_sim + 10
    17  ???                                 0x0000000200ad34fe 0x0 + 8601285886
    18  ???                                 0x0000000200ace000 0x0 + 8601264128
)

Has anyone faced something like that?

Side notes:

  1. My app uses a third-party SDK, could it be that the SDK is faulty?
  2. xCode version is 13.2.1

Upvotes: 1

Views: 1106

Answers (2)

Anshif yaseen
Anshif yaseen

Reputation: 79

satya5614:- https://developer.apple.com/forums/thread/733326?page=2

I had the same issue in my react-native project when running the app on iOS 17 simulator. After banging my head for 2 days I finally fixed this issue.

Reason The reason for this error is that the UIGraphicsBeginImageContext and UIGraphicsBeginImageContextWithOption are depreciated.

Fix To fix this issue either remove, comment or replace UIGraphicsBeginImageContext and UIGraphicsBeginImageContextWithOption with UIGraphicsImageRenderer. To do this here are the steps that I followed.

  1. First search the whole project with the command grep -r "UIGraphicsBeginImageContext" ./ this will list all the files using UIGraphicsBeginImageContext or UIGraphicsBeginImageContextWithOption. This step is important as you won't know how many packages are there which refrences the UIGraphicsBeginImageContext. In my case I had several react-native packages as well as pods having UIGraphicsBeginImageContext

  2. Then one-by-one remove or replace it with UIGraphicsImageRenderer. Replacing with UIGraphicsImageRenderer will be tricky if you don't have good idea of objective c. So, I suuggest first commenting and then checking if hte solution works for you.

  3. Clean project, delete the app from simulator and then reinstall. Hopefully this will fix the issue. It did for me.

Upvotes: 1

Keselme
Keselme

Reputation: 4239

As pointed out by matt in the comment, the problem was indeed with the SDK.

Upvotes: 0

Related Questions