Crashing due to privacy violation

We are receiving these crash reports on iOS 11 (they occur on a background thread on the "com.apple.root.default-qos" queue).

libsystem_kernel.dylib         0x1831a00a8 __abort_with_payload + 8
libsystem_kernel.dylib         0x18319b100 abort_with_payload_wrapper_internal + 100
libsystem_kernel.dylib         0x18319b12c system_set_sfi_window + 10
TCC                            0x1860ed99c __TCCAccessRequest_block_invoke_2.85 + 222
TCC                            0x1860ed8bc __CRASHING_DUE_TO_PRIVACY_VIOLATION__ + 706
TCC                            0x1860f113c __tccd_send_block_invoke + 316
libxpc.dylib                   0x1832eda0c _xpc_connection_reply_callout + 60
libxpc.dylib                   0x1832ed948 _xpc_connection_call_reply_async + 88
libdispatch.dylib              0x18300d758 _dispatch_client_callout3 + 16
libdispatch.dylib              0x183025060 _dispatch_mach_msg_async_reply_invoke$VARIANT$mp + 324
libdispatch.dylib              0x183013f54 _dispatch_queue_override_invoke$VARIANT$mp + 400
libdispatch.dylib              0x18301a1c8 _dispatch_root_queue_drain + 596
libdispatch.dylib              0x183019f10 _dispatch_worker_thread3 + 120
libsystem_pthread.dylib        0x1832b3130 _pthread_wqthread + 1268
libsystem_pthread.dylib        0x1832b2c30 start_wqthread + 4

The stack trace doesn't help much except for the __CRASHING_DUE_TO_PRIVACY_VIOLATION__ symbol. We do have these keys specified in Info.plist:

  • NSPhotoLibraryUsageDescription
  • NSCameraUsageDescription
  • NSLocationWhenInUseUsageDescription

I am pretty sure we don't try to access contacts, health data or anything else requiring a permission from users. Also, we haven't been able to reproduce the problem during our internal testing. Still, it looks like in certain rare circumstances (for about 1 in 1500 users) the app is trying to access some private data.


Does anybody have a clue how to debug and fix these privacy violation crashes? Can it be a 3rd party keyboard extension, a data detector in a Safari view controller or anything like that?


Thanks in advance.

Accepted Reply

Are you getting the crash reports from iTunes Connect? Typically, the termination reason is at the top of the system generated crash reports, for example:

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: TCC, This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
Triggered by Thread:  3


I can create this exact thread by accessing Photos using PHPhotoLibrary without NSPhotoLibraryUsageDescription:

Thread 2 name:  Dispatch queue: com.apple.mobileslideshow.accessCallbacks
Thread 2:
0   libsystem_kernel.dylib         0x00000001816b4c00 semaphore_wait_trap + 8
1   libdispatch.dylib             0x0000000181572024 _dispatch_sema4_wait$VARIANT$armv81 + 24
2   libdispatch.dylib             0x00000001815729c0 _dispatch_semaphore_wait_slow + 124
3   AssetsLibraryServices         0x000000018f0e29c4 __79-[PLPrivacy _isPhotosAccessAllowedWithScope:forceHandler:accessAllowedHandler:]_block_invoke_2 + 416
4   AssetsLibraryServices         0x000000018f0ccd98 __pl_dispatch_async_block_invoke + 36
5   libdispatch.dylib             0x0000000181541088 _dispatch_call_block_and_release + 24
6   libdispatch.dylib             0x0000000181541048 _dispatch_client_callout + 16
7   libdispatch.dylib             0x000000018157f1c0 _dispatch_queue_serial_drain$VARIANT$armv81 + 520
8   libdispatch.dylib             0x000000018157fb30 _dispatch_queue_invoke$VARIANT$armv81 + 340
9   libdispatch.dylib             0x0000000181580528 _dispatch_root_queue_drain_deferred_wlh$VARIANT$armv81 + 380
10  libdispatch.dylib             0x00000001815885c4 _dispatch_workloop_worker_thread$VARIANT$armv81 + 640
11  libsystem_pthread.dylib       0x00000001817e6fd0 _pthread_wqthread + 932
12  libsystem_pthread.dylib       0x00000001817e6c20 start_wqthread + 4


Does anybody have a clue how to debug and fix these privacy violation crashes? Can it be a 3rd party keyboard extension, a data detector in a Safari view controller or anything like that?

The crash report will tell you which process crashed, and the code path triggering this must be within that process.

Replies

Update. In most cases there's also a "com.apple.mobileslideshow.accessCallbacks" thread in this state:

libsystem_kernel.dylib         0x181554c00 semaphore_wait_trap + 8
libdispatch.dylib              0x1813e33d4 _dispatch_sema4_wait$VARIANT$mp + 24
libdispatch.dylib              0x1813e3d84 _dispatch_semaphore_wait_slow + 140
AssetsLibraryServices          0x18ef359c4 __79-[PLPrivacy _isPhotosAccessAllowedWithScope:forceHandler:accessAllowedHandler:]_block_invoke_2 + 416
AssetsLibraryServices          0x18ef1fd98 __pl_dispatch_async_block_invoke + 36
libdispatch.dylib              0x1813e1088 _dispatch_call_block_and_release + 24
libdispatch.dylib              0x1813e1048 _dispatch_client_callout + 16
libdispatch.dylib              0x1813eae48 _dispatch_queue_serial_drain$VARIANT$mp + 528
libdispatch.dylib              0x1813eb7d8 _dispatch_queue_invoke$VARIANT$mp + 340
libdispatch.dylib              0x1813ec200 _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 400
libdispatch.dylib              0x1813f44a0 _dispatch_workloop_worker_thread$VARIANT$mp + 644
libsystem_pthread.dylib        0x181686fe0 _pthread_wqthread + 932
libsystem_pthread.dylib        0x181686c30 start_wqthread + 4

While this suggests there's a privacy violation because of our usage of UIImagePickerController, the app has NSPhotoLibraryUsageDescription key both in Info.plist and in localized InfoPlist.strings files. If a user denies access to the photo library, that shouldn't cause a privacy violation crash, right?


In a couple of cases there's no "com.apple.mobileslideshow.accessCallbacks" thread, but there's a "com.apple.coremedia.capturesource.notifications" or "com.apple.avfoundation.audiocapturedevice.source_queue" thread, which suggests the app is capturing audio, but we've definitely never asked for this, we have no use for the microphone and the app is not even linked against AVFoundation, at least directly. I can imagine users activating dictation, but the app doesn't require it and it's still not clear why using dictation would constitute a privacy violation.

Are you getting the crash reports from iTunes Connect? Typically, the termination reason is at the top of the system generated crash reports, for example:

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: TCC, This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
Triggered by Thread:  3


I can create this exact thread by accessing Photos using PHPhotoLibrary without NSPhotoLibraryUsageDescription:

Thread 2 name:  Dispatch queue: com.apple.mobileslideshow.accessCallbacks
Thread 2:
0   libsystem_kernel.dylib         0x00000001816b4c00 semaphore_wait_trap + 8
1   libdispatch.dylib             0x0000000181572024 _dispatch_sema4_wait$VARIANT$armv81 + 24
2   libdispatch.dylib             0x00000001815729c0 _dispatch_semaphore_wait_slow + 124
3   AssetsLibraryServices         0x000000018f0e29c4 __79-[PLPrivacy _isPhotosAccessAllowedWithScope:forceHandler:accessAllowedHandler:]_block_invoke_2 + 416
4   AssetsLibraryServices         0x000000018f0ccd98 __pl_dispatch_async_block_invoke + 36
5   libdispatch.dylib             0x0000000181541088 _dispatch_call_block_and_release + 24
6   libdispatch.dylib             0x0000000181541048 _dispatch_client_callout + 16
7   libdispatch.dylib             0x000000018157f1c0 _dispatch_queue_serial_drain$VARIANT$armv81 + 520
8   libdispatch.dylib             0x000000018157fb30 _dispatch_queue_invoke$VARIANT$armv81 + 340
9   libdispatch.dylib             0x0000000181580528 _dispatch_root_queue_drain_deferred_wlh$VARIANT$armv81 + 380
10  libdispatch.dylib             0x00000001815885c4 _dispatch_workloop_worker_thread$VARIANT$armv81 + 640
11  libsystem_pthread.dylib       0x00000001817e6fd0 _pthread_wqthread + 932
12  libsystem_pthread.dylib       0x00000001817e6c20 start_wqthread + 4


Does anybody have a clue how to debug and fix these privacy violation crashes? Can it be a 3rd party keyboard extension, a data detector in a Safari view controller or anything like that?

The crash report will tell you which process crashed, and the code path triggering this must be within that process.

Thanks a lot!


I should have looked at crash reports from the App Store first (I was looking at those from Crashlytics), because they do include a descriptive termination reason:

"TCC, This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryAddUsageDescription key with a string value explaining to the user how the app uses this data."


I somehow missed the NSPhotoLibraryAddUsageDescription key, which is, I guess, new in iOS 11.

Yes, NSPhotoLibraryAddUsageDescription is new in iOS 11 for apps needing write access but not read access to the user's photo library.

Hi edford!


Thanks for the response!


What I'm wondering however is, why is NSPhotoLibraryAddUsageDescription required if the app already has NSPhotoLibraryUsageDescription permissions, given that the latter denotes read/write permissions, and thus seems like a superset of the former [1]. Our app is crashing with the same stacktrace, but we can't seem to find any part of our app that actually does a write via the Photos framework.


“Include the NSPhotoLibraryAddUsageDescription key (in apps that link on or after iOS 11) or NSPhotoLibraryUsageDescription key in your app’s Info.plist file and provide a purpose string for the key”


Don't seem to see any suggestion of needing both.


[1] [Information Property List Key Reference - Cocoa Keys](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html)

Hi! How can I watch the crash logs on Itunes Connect? Currently, I only can find a way look at those in Xcode. Thanks in advance!

iTunes Connect collects the crash data and distributes it to you through Xcode.

I have a small sample which requests access via both Photos framework and UIImageWriteToSavedPhotosAlbum, and I don't see what you described. Do you have code to share that demonstrates this?

Well, i cannot find the crashes anymore via itunesconnect UI


Only in XCode, bute there i cannot find any Termination Reason and i have no idea what permission lead to the crash.

Tripple checked anything allready, so how to figure out?

You can start a new thread here on the forums and share the entire crash log as a starting point.

Dont know if you have already found how to view crash details, but this might be usefull to someone else. In XCode organizer right click on crash to view it in finder, then right click on .xccrashpoint file - Show Package Contents, there you will find your .crash files in DistributionInfo/all/Logs folder that can be opened with any text editor.

Thanks. This is the answer we need. I don't know why xcode makes this so hard to find now...