app crashes reported due to missing NSPhotoLibraryAddUsageDescription, but my app never uses any photos

十年热恋 提交于 2021-02-18 07:33:18

问题


I'm seeing a few crash reports that say

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 NSPhotoLibraryAddUsageDescription key with a string value explaining to the user how the app uses this data.

All very interesting, especially because my app never goes anywhere near the photo library for any reason whatever. So what on earth is going on here, and what's TCC anyhow?

I'm perfectly willing to add this key, but I have no explanation for why it would be needed so I can't supply any meaningful text!

Problem arises in iOS 12.1 only, though that might not be meaningful data as you can't prove a negative. I suspect an iOS bug of course, and will report this, but I'm curious as to whether anyone else has seen this odd phenomenon.

Here's a bit more of a typical crash report:

Triggered by Thread: 3

[skipping thread 0 and 1]

Thread 2 name:
Thread 2:
0   libsystem_kernel.dylib          0x000000019ffe3f0c semaphore_wait_trap + 8
1   libdispatch.dylib               0x000000019fe32f8c _dispatch_sema4_wait$VARIANT$mp + 24 (lock.c:134)
2   libdispatch.dylib               0x000000019fe33a10 _dispatch_semaphore_wait_slow + 136 (semaphore.c:132)
3   AssetsLibraryServices           0x00000001ade2d140 __79-[PLPrivacy _isPhotosAccessAllowedWithScope:forceHandler:accessAllowedHandler:]_block_invoke_2 + 412 (PLPrivacy.m:183)
4   AssetsLibraryServices           0x00000001ade138b4 __pl_dispatch_async_block_invoke + 36 (PLDispatchHelpers.m:23)
[skipping the rest]

Thread 3 Crashed:
0   libsystem_kernel.dylib          0x000000019ffeddf8 __abort_with_payload + 8
1   libsystem_kernel.dylib          0x000000019ffe7838 abort_with_payload_wrapper_internal + 100 (terminate_with_reason.c:71)
2   libsystem_kernel.dylib          0x000000019ffe7868 abort_with_payload + 12 (terminate_with_reason.c:93)
3   TCC                             0x00000001a32aea70 __CRASHING_DUE_TO_PRIVACY_VIOLATION__ + 204 (TCC.c:372)
4   TCC                             0x00000001a32ae9a4 __TCCAccessRequest_block_invoke.77 + 708 (TCC.c:508)
5   TCC                             0x00000001a32b2a90 __tccd_send_message_block_invoke + 276 (TCC.c:220)
[skipping the rest]

回答1:


I was able to reproduce the crash! Here's the deal: my app contains a web view. If the user presses on an image in that web view, a Save menu item appears. If the user taps Save, we need permission; if there's no privacy string in the Info.plist, we crash at that moment (and if there is one, we get the authorization dialog).

In my opinion, this is an iOS bug. I never intended for the user to do this; it's just a feature of web views. The act of saving from the web view to the photos library is therefore effectively out of process; it's the user who is doing it, not my app. And the user should not need permission; it's the user who tapped on the image and who then tapped the Save button. There is no way this scenario could have happened without the user making multiple deliberate moves, none of which involve my app directly. I'll be reporting this to Apple.



来源:https://stackoverflow.com/questions/53439457/app-crashes-reported-due-to-missing-nsphotolibraryaddusagedescription-but-my-ap

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!