TCC __TCCAccessRequest_block_invoke

2020-08-26 10:50发布

问题:

I'm getting this error frequently in Crashlytics.

TCC __TCCAccessRequest_block_invoke_2.80 + 222
TCC __CRASHING_DUE_TO_PRIVACY_VIOLATION__ + 682

In my app i'm downloading images and stored that images in photo gallery directly, i'm not creating suppurate folder to store these images. For this in plist i added access permission.

Privacy - Photo Library Additions Usage Description - Save downloaded photos in gallary
Privacy - Camera Usage Description - This app not access your Camera
Privacy - Microphone Usage Description - This app not access your Microphone

But i'm getting lot of crashes. See the below screen shot....

Can any one help me...

回答1:

Ok this has been driving me nuts for the last couple of weeks. In my case I was missing: NSPhotoLibraryAddUsageDescription Which is apparently needed if the user tries to use the "save to camera roll" in the share controller. This appears to be new to iOS 11.

I already had this

NSPhotoLibraryUsageDescription

Which I used when user wanted to import. This gives me read/write permissions. However if the user went to export and used share controller prior to importing it would crash the app if NSPhotoLibraryAddUsageDescription wasn't in the plist. Hopefully this helps you and if not someone else.



回答2:

Do you really need to save the photos? If yes, the above answer works.

But if you have an app like mine which should NOT ALLOW user to save photos and the app still is crashing, then

Check all of your WKWebView that is are loading images. If you long press on Webview it shows an option to save photos in app.

Fix for the crash:

webView?.allowsLinkPreview = false