iOS 10 - 请求相机,麦克风和照片库权限导致应用程序崩溃的更改 [英] iOS 10 - Changes in asking permissions of Camera, microphone and Photo Library causing application to crash

查看:573
本文介绍了iOS 10 - 请求相机,麦克风和照片库权限导致应用程序崩溃的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 10 现在需要用户权限才能访问媒体库,照片,相机和其他类似的硬件。解决方法是将他们的密钥添加到 info.plist 中,并告知用户我们如何使用他们的数据,



我只能找到几个键

  NSPhotoLibraryUsageDescription 
NSMicrophoneUsageDescription
NSCameraUsageDescription

我想知道是否还有其他硬件的密钥,如 iOS 10 如果您没有提供 info.plist 并使用正确的密钥描述,那么如果使用XCode-8 beta进行构建,您的应用程序将崩溃

解决方案

您可以在您的指定中列出所有 Cocoa Keys Info.plist file:







来源



并按以下方式添加:

 < key> NSLocationAlwaysUsageDescription< / key> 
< string> $ {PRODUCT_NAME}始终使用位置< / string>

所有隐私密钥列表:

  NSCameraUsageDescription 
NSBluetoothPeripheralUsageDescription
NSCalendarsUsageDescription
NSContactsUsageDescription
NSHealthShareUsageDescription
NSHealthUpdateUsageDescription
NSHomeKitUsageDescription
NSLocationAlwaysUsageDescription
NSLocationUsageDescription
NSLocationWhenInUseUsageDescription
NSAppleMusicUsageDescription
NSMicrophoneUsageDescription
NSMotionUsageDescription
kTCCServiceMediaLibrary
NSPhotoLibraryUsageDescription
NSRemindersUsageDescription
NSSiriUsageDescription
NSSpeechRecognitionUsageDescription
NSVideoSubscriberAccountUsageDescription


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 description for user that how we are using their data,

I could only find 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.

解决方案

There is a list of all Cocoa Keys that you can specify in your Info.plist file:

https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html

(Xcode target -> Info -> Custom iOS Target Properties)

iOS already required permissions to access microphone, camera, and media library earlier (iOS6, iOS7), but since iOS10 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:

Source

You can also open Info.plist as source code:

Source

And add them like this:

<key>NSLocationAlwaysUsageDescription</key>
<string>${PRODUCT_NAME} always location use</string>

List of all privacy keys:

NSCameraUsageDescription
NSBluetoothPeripheralUsageDescription
NSCalendarsUsageDescription
NSContactsUsageDescription
NSHealthShareUsageDescription
NSHealthUpdateUsageDescription
NSHomeKitUsageDescription
NSLocationAlwaysUsageDescription
NSLocationUsageDescription
NSLocationWhenInUseUsageDescription
NSAppleMusicUsageDescription
NSMicrophoneUsageDescription
NSMotionUsageDescription
kTCCServiceMediaLibrary
NSPhotoLibraryUsageDescription
NSRemindersUsageDescription
NSSiriUsageDescription
NSSpeechRecognitionUsageDescription
NSVideoSubscriberAccountUsageDescription

这篇关于iOS 10 - 请求相机,麦克风和照片库权限导致应用程序崩溃的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆