zoukankan      html  css  js  c++  java
  • 【转载】ios11 相册读写权限 变更

    http://www.jianshu.com/p/c03a87e4ca87

    大家都知道访问相册需要申请用户权限。 相册权限需要在info.plist—Property List文件中添加NSPhotoLibraryUsageDescription键值对,描述文字不能为空。 iOS11之前:访问相册和存储照片到相册(读写权限),需要用户授权,需要添加NSPhotoLibraryUsageDescription。
    iOS11之后:默认开启访问相册权限(读权限),无需用户授权,无需添加NSPhotoLibraryUsageDescription,适配iOS11之前的还是需要加的。 添加图片到相册(写权限),需要用户授权,需要添加NSPhotoLibraryAddUsageDescription

    总结:iOS11之后如果需要写入权限需要添加
    NSPhotoLibraryAddUsageDescription字段。  
       NSPhotoLibraryUsageDescription:
    Property List:
       Privacy - Photo Library Usage Description
    Source Code:
      NSPhotoLibraryUsageDescription
    
    是否允许此APP使用相册?
       NSPhotoLibraryAddUsageDescription :
    Property List:
       Privacy - Photo Library Additions Usage Description
    Source Code:
       NSPhotoLibraryAddUsageDescription
    
    是否允许此APP保存图片到相册?

    苹果官方文档说明:

    https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW73

    NSPhotoLibraryAddUsageDescription

    NSPhotoLibraryAddUsageDescription (String - iOS) This key lets you describe the reason your app seeks write-only access to the user’s photo library. When the system prompts the user to allow access, this string is displayed as part of the alert.

    Important: To protect user privacy, an iOS app linked on or after iOS 10.0, and that accesses the user’s photo library, must statically declare the intent to do so. Include the NSPhotoLibraryAddUsageDescription key (in apps that link on or after iOS 11) or NSPhotoLibraryUsageDescription key in your app’s Info.plist file and provide a purpose string for the key. If your app attempts to access the user’s photo library without a corresponding purpose string, your app exits.

    This key is supported in iOS 11.0 and later.

    NSPhotoLibraryUsageDescription

    NSPhotoLibraryUsageDescription (String - iOS) This key lets you describe the reason your app accesses the user’s photo library. When the system prompts the user to allow access, this string is displayed as part of the alert.

    Although this keys governs read and write access to the user’s photo library, it’s best to use NSPhotoLibraryAddUsageDescription if your app needs only to add assets to the library and does not need to read any assets.

    Important: To protect user privacy, an iOS app linked on or after iOS 10.0, and that accesses the user’s photo library, must statically declare the intent to do so. Include the NSPhotoLibraryUsageDescription key in your app’s Info.plist file and provide a purpose string for this key. If your app attempts to access the user’s photo library without a corresponding purpose string, your app exits.

    This key is supported in iOS 6.0 and later.



    作者:小孩仔
    链接:http://www.jianshu.com/p/c03a87e4ca87
    來源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
  • 相关阅读:
    js判断用户是否在浏览当前页面
    js不改变原对象情况下复制对象object
    js实现jquery中的addClass,removeClass,hasClass方法
    npm install总结 (--savenpm install --save与npm install --save-dev区别及其他相关)
    通过正则实时监听检查input输入,实时反应,不符合不能输入的功能详解
    IE8常见兼容问题及解决方法总结
    javascript中十六进制和ASCII码互相转换
    vue2.0中watch总结:普通监听和深度监听
    js对象数组操作之一:对象数组中对象去重的方法总结
    webpack4配置详细过程及采坑
  • 原文地址:https://www.cnblogs.com/huangzizhu/p/7698648.html
Copyright © 2011-2022 走看看