由于隐私敏感数据,应用程序在 iOS 11 崩溃
Application crashing on iOS 11 due to privacy-sensitive data
我的应用程序在 iOS 10 中运行顺利,但当我将应用程序更新到 iOS 11 时,应用程序开始崩溃。我收到以下错误:
This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSContactsUsageDescription key with a string value explaining to the user how the app uses this data.
这是因为您试图在未经许可的情况下访问敏感数据。为避免这种情况,您需要在所有目标的 info.plist 文件中添加一个条目。并指定访问敏感数据的正当理由。
谢谢
正如您的错误提示,只需添加
"Privacy - Contacts Usage Description"
进入你的info.plist。它将是 String 类型,因此添加您想要显示给请求访问 his/her 联系人列表的用户的任何弹出消息。例如。你可以写 "Application wants to access your contacts list."
Key will be "Privacy - Contacts Usage Description"
and
Value will be "Application wants to access your contacts list."
您必须声明对任何用户私有数据类型的访问权限。您可以通过向应用程序的 Info.plist 添加一个使用密钥以及一个目的字符串来完成此操作。
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) photo use</string>
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) camera use</string>
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) microphone use</string>
<key>NSLocationUsageDescription</key>
<string>$(PRODUCT_NAME) location use</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) location use</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>$(PRODUCT_NAME) always uses location </string>
<key>NSCalendarsUsageDescription</key>
<string>$(PRODUCT_NAME) calendar events</string>
<key>NSRemindersUsageDescription</key>
<string>$(PRODUCT_NAME) reminder use</string>
<key>NSContactsUsageDescription</key>
<string>$(PRODUCT_NAME) contact use</string>
<key>NSMotionUsageDescription</key>
<string>$(PRODUCT_NAME) motion use</string>
<key>NSHealthUpdateUsageDescription</key>
<string>$(PRODUCT_NAME) heath update use</string>
<key>NSHealthShareUsageDescription</key>
<string>$(PRODUCT_NAME) heath share use</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>$(PRODUCT_NAME) Bluetooth Peripheral use</string>
<key>NSAppleMusicUsageDescription</key>
<string>$(PRODUCT_NAME) media library use</string>
<key>NSSiriUsageDescription</key>
<string>$(PRODUCT_NAME) siri use</string>
<key>NSHomeKitUsageDescription</key>
<string>$(PRODUCT_NAME) home kit use</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>$(PRODUCT_NAME) speech use</string>
<key>NSVideoSubscriberAccountUsageDescription</key>
<string>$(PRODUCT_NAME) tvProvider use</string>
您可以阅读所有隐私说明here。
<key>NSContactsUsageDescription</key>
<string>Required to show list of contacts</string>
只需将其写入您的 info.plist 文件即可。
我的应用程序在 iOS 10 中运行顺利,但当我将应用程序更新到 iOS 11 时,应用程序开始崩溃。我收到以下错误:
This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSContactsUsageDescription key with a string value explaining to the user how the app uses this data.
这是因为您试图在未经许可的情况下访问敏感数据。为避免这种情况,您需要在所有目标的 info.plist 文件中添加一个条目。并指定访问敏感数据的正当理由。
谢谢
正如您的错误提示,只需添加
"Privacy - Contacts Usage Description"
进入你的info.plist。它将是 String 类型,因此添加您想要显示给请求访问 his/her 联系人列表的用户的任何弹出消息。例如。你可以写 "Application wants to access your contacts list."
Key will be "Privacy - Contacts Usage Description"
and
Value will be "Application wants to access your contacts list."
您必须声明对任何用户私有数据类型的访问权限。您可以通过向应用程序的 Info.plist 添加一个使用密钥以及一个目的字符串来完成此操作。
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) photo use</string>
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) camera use</string>
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) microphone use</string>
<key>NSLocationUsageDescription</key>
<string>$(PRODUCT_NAME) location use</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) location use</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>$(PRODUCT_NAME) always uses location </string>
<key>NSCalendarsUsageDescription</key>
<string>$(PRODUCT_NAME) calendar events</string>
<key>NSRemindersUsageDescription</key>
<string>$(PRODUCT_NAME) reminder use</string>
<key>NSContactsUsageDescription</key>
<string>$(PRODUCT_NAME) contact use</string>
<key>NSMotionUsageDescription</key>
<string>$(PRODUCT_NAME) motion use</string>
<key>NSHealthUpdateUsageDescription</key>
<string>$(PRODUCT_NAME) heath update use</string>
<key>NSHealthShareUsageDescription</key>
<string>$(PRODUCT_NAME) heath share use</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>$(PRODUCT_NAME) Bluetooth Peripheral use</string>
<key>NSAppleMusicUsageDescription</key>
<string>$(PRODUCT_NAME) media library use</string>
<key>NSSiriUsageDescription</key>
<string>$(PRODUCT_NAME) siri use</string>
<key>NSHomeKitUsageDescription</key>
<string>$(PRODUCT_NAME) home kit use</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>$(PRODUCT_NAME) speech use</string>
<key>NSVideoSubscriberAccountUsageDescription</key>
<string>$(PRODUCT_NAME) tvProvider use</string>
您可以阅读所有隐私说明here。
<key>NSContactsUsageDescription</key>
<string>Required to show list of contacts</string>
只需将其写入您的 info.plist 文件即可。