[英]App Crashes when requesting Location in iOs 10
在我的应用程序中,我用于获取位置数据并将其发送回服务器。 该应用程序在以前的版本中运行良好,并且在iOs 10中崩溃。我使用的是Xcode8。以下消息显示在日志中。
Couldn't find the "com.apple.private.externalaccessory.showallaccessories" entitlement
[MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/delta/Library/Developer/CoreSimulator/Devices/EE3BD084-BA73-44F6-AD95-BE49BBE838AC/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
[MC] Reading from private effective user settings.
所以我该如何解决。
在iOS 10中,如果要访问私有数据,则有一个重大变化,那就是必须提前声明,否则您的应用将崩溃。
如果您使用下面列出的任何框架
联系人,日历,提醒,照片,蓝牙共享,麦克风,相机,位置,健康状况,HomeKit,媒体库,动作,CallKit,语音识别,SiriKit
您必须在Info.plist中声明描述
这是您必须为iOS10声明的Info.plist键的完整列表。
<!-- Photo Library -->
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) photo use</string>
<!-- Camera -->
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) camera use</string>
<!-- Microphone -->
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) microphone use</string>
<!-- Location -->
<key>NSLocationUsageDescription</key>
<string>$(PRODUCT_NAME) location use</string>
<!-- Location When In Use -->
<key>NSLocationWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) location use</string>
<!-- Location Always -->
<key>NSLocationAlwaysUsageDescription</key>
<string>$(PRODUCT_NAME) always uses location </string>
<!-- Calendars -->
<key>NSCalendarsUsageDescription</key>
<string>$(PRODUCT_NAME) calendar events</string>
<!-- Reminders -->
<key>NSRemindersUsageDescription</key>
<string>$(PRODUCT_NAME) reminder use</string>
<!-- Contacts -->
<key>NSContactsUsageDescription</key>
<string>$(PRODUCT_NAME) contact use</string>
<!-- Motion -->
<key>NSMotionUsageDescription</key>
<string>$(PRODUCT_NAME) motion use</string>
<!-- Health Update -->
<key>NSHealthUpdateUsageDescription</key>
<string>$(PRODUCT_NAME) heath update use</string>
<!-- Health Share -->
<key>NSHealthShareUsageDescription</key>
<string>$(PRODUCT_NAME) heath share use</string>
<!-- Bluetooth Peripheral -->
<key>NSBluetoothPeripheralUsageDescription</key>
<string>$(PRODUCT_NAME) Bluetooth Peripheral use</string>
<!-- Media Library -->
<key>NSAppleMusicUsageDescription</key>
<string>$(PRODUCT_NAME) media library use</string>
<!-- Siri -->
<key>NSSiriUsageDescription</key>
<string>$(PRODUCT_NAME) siri use</string>
<!-- HomeKit -->
<key>NSHomeKitUsageDescription</key>
<string>$(PRODUCT_NAME) home kit use</string>
<!-- SpeechRecognition -->
<key>NSSpeechRecognitionUsageDescription</key>
<string>$(PRODUCT_NAME) speech use</string>
<!-- VideoSubscriber -->
<key>NSVideoSubscriberAccountUsageDescription</key>
<string>$(PRODUCT_NAME) tvProvider use</string>
也
能够与外部附件通信的应用程序必须在其Info.plist文件中声明其支持的协议。
要声明您的应用程序支持的协议,您必须在应用程序的Info.plist文件中包含UISupportedExternalAccessoryProtocols键。 此项包含一个字符串数组,这些字符串标识应用程序支持的通信协议。
希望能帮助到你..!!
转到应用程序Info.Plist文件,并根据您的要求添加了隐私密钥。
位置:密钥:隐私-位置始终使用说明
值:$(PRODUCT_NAME)位置使用
密钥:隐私-使用时的位置用法说明
值:$(PRODUCT_NAME)位置使用
如果您添加了以上隐私密钥,但仍使应用程序崩溃。 然后启用适当的“ 功能 ”
示例 :如果您正在使用“ 使用Bluettoth LE附件 ”
项目->功能->后台模式->使用Bluetooth LE配件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.