So I am trying to make my app work on iOS and MacOS. Which to say it does run on both. However when I submitted it to Apple, they seemed to of made it crash. Due to the following
Crashed Thread: 3 Dispatch queue: com.apple.CoreLocation.0x7fc93e530920
Now I can tell it is due to CoreLocation, But I am wondering why did it not crash on my mac when I tested it (same version) 13.15.6.
Next is how do I fix this, if I can't get the error to happen again?
Encountered this too. In my case on macOS 10.15 all ran fine, but got a crash report when the application was submitted for review, where it crashed on Big Sur (macOS 11.3) with this error.
The solution (for me) is to add the key NSLocationUsageDescription
to the plist in the Mac version.
See https://developer.apple.com/forums/thread/652193 and Apple doc
I could only intermittently reproduce this error, and when it happened it happened the moment I enabled Location Services in System Preferences. I guess that is the moment that CoreLocation inspects the plist, and sometimes crashes, i.e. not always.
Addition: For macOS 11 (Big Sur) the authorisation of access to location has changed more than described above. Depending on your needs you need to ask for access to location, as described in https://developer.apple.com/documentation/corelocation/requesting_authorization_for_location_services?language=objc.
So, this is 4 possible keys and "purpose strings" for the plist, that steer the authorisation via system alerts, with the user's choice handed to you via the delegate locationManagerDidChangeAuthorization:
.
Note that location will work fine without these strings, but you will run into a rejection with the AppStore when you submit your application for review.
Also note that if your Mac has location services NOT enabled at all in
System Preferences -> Security&Privacy -> Privacy -> Location services
no system alerts will show up at all. It is assumed that if not enabled the user does not want to be bothered.