简体   繁体   English

Xcode 8.0 GM iPhone Simulator(iOS 10)崩溃

[英]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. 但是,当我尝试在模拟器(iOS 10,iPhone 7和iPhone 6)上运行它时,该应用程序崩溃了,并且在调试器输出中没有调试器消息。

The crashed Thread look like this 崩溃的线程看起来像这样

在此处输入图片说明

I want to know what the 我想知道

TCC` CRASHING_DUE_TO_PRIVACY_VIOLATION TCC` CRASHING_DUE_TO_PRIVACY_VIOLATION

means , and how to fix the problem? 意味着,以及如何解决该问题?

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. TCC处理对此类资源的访问,并且__CRASHING_DUE_TO_PRIVACY_VIOLATION__的崩溃通常意味着您不满足使用该功能的要求。

Make sure you have the usage description key for any of those features in your Info.plist file. 确保您具有Info.plist文件中所有这些功能的使用情况描述密钥。 iOS 10 now absolutely requires you supply descriptions such as: iOS 10现在绝对需要您提供以下描述:

<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. 如果您删除该应用程序并等待24小时(或在以前从未安装过该应用程序的其他设备上安装),则可能会在设备上看到相同的内容。 (Different services have different policies for whether permission disappears quickly or is saved for a while to allow for reinstalls). (关于权限是快速消失还是保留一段时间以允许重新安装,不同的服务具有不同的策略)。

Update: 更新:

There is a nice Technical Q&A page on developer.apple.com that describes the frameworks that require a usage description and lists the relevant key(s) for each framework and the class/function/selector(s) involved. 在developer.apple.com上有一个很好的技术问答页面,该页面描述了需要用法说明的框架,并列出了每个框架的相关键以及所涉及的类/函数/选择器。

In addition to @russbishop's answer: 除了@russbishop的答案:

You need to do the same thing for accessing gallery as well. 您还需要做同样的事情才能访问图库。 Something like: 就像是:

<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) needs access to use your photo library</string>

PS: Totally opposite to your case, I was getting this same crash on device but not on simulator. PS:与您的情况完全相反,我在设备上遇到了相同的崩溃,但在模拟器上却没有。

In addition to all above answers: 除上述所有答案外:

For me it was the camera and microphone, NSCameraUsageDescription and NSMicrophoneUsageDescription. 对我而言,它是相机和麦克风,NSCameraUsageDescription和NSMicrophoneUsageDescription。

If you want to record video you should add both of them. 如果要录制视频,则应同时添加两者。

Thanx Apple. 谢谢苹果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM