iOS 10 - 更改相机、麦克风和照片库的权限导致应用程序崩溃 [英] iOS 10 - Changes in asking permissions of Camera, microphone and Photo Library causing application to crash
问题描述
iOS 10,现在需要用户权限才能访问媒体库、照片、相机和其他类似的硬件.解决方案是将他们的密钥添加到 info.plist
中,并为用户说明我们如何使用他们的数据,
我只能找到几个键
NSPhotoLibraryUsageDescriptionNSMicrophoneUsageDescriptionNSCameraUsageDescription
我想知道在 iOS 10
中是否还有更多用于其他硬件的密钥 如果您没有为 info.plist
提供正确的密钥描述如果使用 XCode - 8 beta 构建,您的应用程序将崩溃.
[更新隐私密钥列表到 iOS 13 - 见下文]
您可以在 Info.plist
文件中指定所有 Cocoa Keys
的列表:
并像这样添加隐私密钥:
NSLocationAlwaysUsageDescription <string>${PRODUCT_NAME} 始终使用位置</string>
所有隐私密钥的列表:[更新至 iOS 13]
NFCReaderUsageDescriptionNSAppleMusicUsageDescriptionNSBluetoothAlwaysUsageDescriptionNSBluetoothPeripheralUsageDescriptionNSCalendarsUsageDescriptionNSCameraUsageDescriptionNSContactsUsageDescriptionNSFaceIDUsageDescriptionNSHealthShareUsageDescriptionNSHealthUpdateUsageDescriptionNSHomeKitUsageDescriptionNSLocationAlwaysUsageDescriptionNSLocationUsageDescriptionNSLocationWhenInUseUsageDescriptionNSMicrophoneUsageDescriptionNSMotionUsageDescriptionNSPhotoLibraryAddUsageDescriptionNSPhotoLibraryUsageDescriptionNSRemindersUsageDescriptionNSSiriUsageDescriptionNSSpeechRecognitionUsageDescriptionNSVideoSubscriberAccountUsageDescription
2019 年更新:
在过去的几个月里,我的两个应用在审核期间被拒绝,因为相机使用说明没有具体说明我如何处理拍摄的照片.
我不得不将描述从 ${PRODUCT_NAME} 需要访问相机才能拍照
更改为 ${PRODUCT_NAME} 需要访问相机才能更新您的头像
即使应用上下文很明显(用户点击了头像).
看来苹果现在更加注重隐私使用说明了,我们应该详细解释我们为什么要征求许可.
iOS 10, Now Requires User Permission to Access Media Library, Photos, Camera and other Hardware like these. The solution for this is to add their keys into info.plist
with a description for user that how we are using their data,
I could only find a few keys
NSPhotoLibraryUsageDescription
NSMicrophoneUsageDescription
NSCameraUsageDescription
I want to know if there are more keys also for other hardware as in iOS 10
if you haven't provided info.plist
with proper keys description your application will crash if build using XCode - 8 beta.
[UPDATED privacy keys list to iOS 13 - see below]
There is a list of all Cocoa Keys
that you can specify in your Info.plist
file:
(Xcode: Target -> Info -> Custom iOS Target Properties)
iOS already required permissions to access microphone, camera, and media library earlier (iOS 6, iOS 7), but since iOS 10 app will crash if you don't provide the description why you are asking for the permission (it can't be empty).
Privacy keys with example description:
Alternatively, you can open Info.plist
as source code:
And add privacy keys like this:
<key>NSLocationAlwaysUsageDescription</key>
<string>${PRODUCT_NAME} always location use</string>
List of all privacy keys: [UPDATED to iOS 13]
NFCReaderUsageDescription
NSAppleMusicUsageDescription
NSBluetoothAlwaysUsageDescription
NSBluetoothPeripheralUsageDescription
NSCalendarsUsageDescription
NSCameraUsageDescription
NSContactsUsageDescription
NSFaceIDUsageDescription
NSHealthShareUsageDescription
NSHealthUpdateUsageDescription
NSHomeKitUsageDescription
NSLocationAlwaysUsageDescription
NSLocationUsageDescription
NSLocationWhenInUseUsageDescription
NSMicrophoneUsageDescription
NSMotionUsageDescription
NSPhotoLibraryAddUsageDescription
NSPhotoLibraryUsageDescription
NSRemindersUsageDescription
NSSiriUsageDescription
NSSpeechRecognitionUsageDescription
NSVideoSubscriberAccountUsageDescription
Update 2019:
In the last months, two of my apps were rejected during the review because the camera usage description wasn't specifying what I do with taken photos.
I had to change the description from ${PRODUCT_NAME} need access to the camera to take a photo
to ${PRODUCT_NAME} need access to the camera to update your avatar
even though the app context was obvious (user tapped on the avatar).
It seems that Apple is now paying even more attention to the privacy usage descriptions, and we should explain in details why we are asking for permission.
这篇关于iOS 10 - 更改相机、麦克风和照片库的权限导致应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!