[英]Is it mandatory to add NSPhotoLibraryUsageDescription in info.plist?
I am not using UIImagePicker in my app and not accessing the Photo Library.我没有在我的应用程序中使用 UIImagePicker,也没有访问照片库。 I got a mail regarding add NSPhotoLibraryUsageDescription in info.plist file.
我收到一封关于在 info.plist 文件中添加 NSPhotoLibraryUsageDescription 的邮件。
I have following questions我有以下问题
How to confirm my project accessing the photo library?如何确认我的项目访问照片库?
I already searched UIImagePicker in my project and did't get any result.我已经在我的项目中搜索了 UIImagePicker 并没有得到任何结果。
Is it mandatory to add NSPhotoLibraryUsageDescription in info.plist while i am not accessing the photo library?当我不访问照片库时,是否必须在 info.plist 中添加 NSPhotoLibraryUsageDescription?
Can any one help to find it out .任何人都可以帮忙找出来。
Thanks谢谢
UIImagePicker用户界面图像选择器
An image picker controller manages user interactions and delivers the results of those interactions to a delegate object.图像选择器控制器管理用户交互并将这些交互的结果传递给委托对象。 The role and appearance of an image picker controller depend on the source type you assign to it before you present it.
图像选择器控制器的角色和外观取决于您在呈现之前为其分配的源类型。
whenever you used UIImagePicker, you have to give permission for that particular application每当您使用 UIImagePicker 时,您都必须授予该特定应用程序的权限
There is a list of all Cocoa Keys that you can specify in your Info.plist file:您可以在 Info.plist 文件中指定所有 Cocoa Keys 的列表:
https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html
(Xcode target -> Info -> Custom iOS Target Properties) (Xcode 目标 -> 信息 -> 自定义 iOS 目标属性)
iOS already required permissions to access microphone, camera, and media library earlier (iOS6, iOS7), but since iOS10 the apps will crash if you don't provide the description why you are asking for the permission. iOS 早先(iOS6、iOS7)已经需要访问麦克风、摄像头和媒体库的权限,但从 iOS10 开始,如果您不提供请求权限的说明,应用程序将崩溃。
UPDATE :更新:
Summary of all privacy keys (with example description):所有私钥的摘要(带有示例说明):
You only have to add this key-value pair to your info.plist if you are actually accessing the photos any way.如果您确实以任何方式访问照片,则只需将此键值对添加到您的 info.plist 中。 If it's not added the app is going to crash.
如果没有添加,应用程序将崩溃。 Check if any of your added dependencies using UIImagePicker.
使用 UIImagePicker 检查是否有任何添加的依赖项。
No it's not mandatory to add NSPhotoLibraryUsageDescription
key in info.plist .不,在info.plist 中添加
NSPhotoLibraryUsageDescription
键不是强制性的。 If your App is not using accessing photo from library/gallery then you should remove it.如果您的应用程序没有使用从图书馆/画廊访问照片,那么您应该将其删除。 But as "@Bence Pattogato" said if Your app accessing photo from library/gallery and there is no key added in info.plist then it will be crash.
但是正如“@Bence Pattogato”所说,如果您的应用程序从图书馆/画廊访问照片并且在 info.plist 中没有添加任何密钥,那么它将崩溃。
For your information below are different keys that required to add info.plist if you accessing relevant features according to camera/photo library.如果您根据相机/照片库访问相关功能,以下是添加info.plist所需的不同键供您参考。
1) NSPhotoLibraryUsageDescription
: This key lets you describe the reason your app accesses the user's photo library. 1)
NSPhotoLibraryUsageDescription
:这个键让你描述你的应用访问用户照片库的原因。 When the system prompts the user to allow access, this string is displayed as part of the alert.当系统提示用户允许访问时,此字符串将作为警报的一部分显示。
2) NSCameraUsageDescription
: describes the reason that the app (including an iMessage app) accesses the device's camera. 2)
NSCameraUsageDescription
:描述应用程序(包括 iMessage 应用程序)访问设备相机的原因。 When the system prompts the user to allow access, this string is displayed as part of the alert.当系统提示用户允许访问时,此字符串将作为警报的一部分显示。
3) NSPhotoLibraryAddUsageDescription
: (New in iOS 11) This key lets you describe the reason your app seeks write-only access to the user's photo library. 3)
NSPhotoLibraryAddUsageDescription
: (iOS 11 中的新增功能)此键可让您描述您的应用寻求对用户照片库进行只写访问的原因。 When the system prompts the user to allow access, this string is displayed as part of the alert.当系统提示用户允许访问时,此字符串将作为警报的一部分显示。
Above information get from this Appel official link. 以上信息来自此 Appel 官方链接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.