Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

__CRASHING_DUE_TO_PRIVACY_VIOLATION__

In Crashlytics, I can see iOS 10 users are getting this crash frequently. However, when I test in Simulator using iPhone 7/10.2, I'm unable to reproduce the crash. In my plist, I already have strings for

NSCalendarsUsageDescription, NSMicrophoneUsageDescription, and NSPhotoLibraryUsageDescription.

Here is the stacktrace from Crashlytics:

Crashed: com.apple.root.default-qos
0  libsystem_kernel.dylib         0x183765d74 __abort_with_payload + 8
1  libsystem_kernel.dylib         0x18376249c <redacted> + 100
2  libsystem_kernel.dylib         0x1837624c8 abort_with_payload + 10
3  TCC                            0x1869d6328 __TCCAccessRequest_block_invoke_2.80 + 258
4  TCC                            0x1869d6224 __CRASHING_DUE_TO_PRIVACY_VIOLATION__ + 702
5  TCC                            0x1869d9330 __tccd_send_block_invoke + 348
6  libxpc.dylib                   0x18386afcc _xpc_connection_reply_callout + 80
7  libxpc.dylib                   0x18386af3c _xpc_connection_call_reply + 40
8  libdispatch.dylib              0x1836221bc _dispatch_client_callout + 16
9  libdispatch.dylib              0x183630a4c _dispatch_queue_override_invoke + 732
10 libdispatch.dylib              0x18363234c _dispatch_root_queue_drain + 572
11 libdispatch.dylib              0x1836320ac _dispatch_worker_thread3 + 124
12 libsystem_pthread.dylib        0x18382b2a0 _pthread_wqthread + 1288
13 libsystem_pthread.dylib        0x18382ad8c start_wqthread + 4

Any clue how to reproduce or fix this? I do allow user to access contacts, but I am not prompted for any permission when I test that feature in simulator. However, when the user accesses the camera from my app, the simulator does prompt me for a permission. That makes me think that a string is not needed for accessing contacts.

like image 722
amit Avatar asked Mar 10 '17 03:03

amit


2 Answers

If you're seeing these crashes on iPhone X and you use Touch ID/Face ID, the reason might be a lack of NSFaceIDUsageDescription key in your Info.plist. The key was added in iOS 11 and looks like it might have become mandatory after iOS 11.3, given that I see a spike of crashes on iPhone X after iOS 11.3 was released. It's vaguely documented by Apple here:

NSFaceIDUsageDescription (String - iOS). This key lets you describe the reason your app uses Face ID.

Important: To protect user privacy, an iOS app that links on or after iOS 11 and that would access Face ID if the hardware supports it, must statically declare the intent to do so. Include the NSFaceIDUsageDescription key in your app’s Info.plist file and provide a purpose string for this key. If your app attempts to access Face ID without a corresponding purpose string, your app may exit.

This key is supported in iOS 11 and later.

Interestingly enough, I wasn't able to reproduce the crash on iOS 11.3 on my development iPhone X, maybe it behaves differently in debug or TestFlight builds. Still worth adding the key when you use Face ID in your app, if we believe Apple's documentation.

like image 147
Max Desiatov Avatar answered Oct 17 '22 23:10

Max Desiatov


I had to add a string for NSCameraUsageDescription in the plist because user is allowed to take photos.

like image 37
amit Avatar answered Oct 17 '22 23:10

amit