wj2061 wj2061 - 1 month ago 78
iOS Question

Crash on Xcode 8.0 GM iPhone Simulator (iOS 10)

When I run my project on real device , everything works fine.

But when I try to run it on the simulators(iOS 10,iPhone 7 && iPhone 6) ,the app crashed and no debugger messages in the Debugger Output.

The crashed Thread look like this

enter image description here

I want to know what the


TCC`CRASHING_DUE_TO_PRIVACY_VIOLATION


means , and how to fix the problem?

Answer

Are you using a feature that requires user approval (like Camera, Location, etc)? TCC handles access to such resources and a crash in __CRASHING_DUE_TO_PRIVACY_VIOLATION__ usually means you aren't fulfilling the requirements to use that feature.

Make sure you have the usage description key for any of those features in your Info.plist file. iOS 10 now absolutely requires you supply descriptions such as:

<key>NSCameraUsageDescription</key>
<string>For taking selfies!</string>

It is probably working on your device because you previously granted permission. If you delete the app and wait 24 hours (or install on a different device that has never had the app installed before) you'd probably see the same thing on device. (Different services have different policies for whether permission disappears quickly or is saved for a while to allow for reinstalls).