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
    來源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
  • 相关阅读:
    图解攻略:轻松在苹果Macbook Air上装Win7
    Redis的安装与idea中的使用
    CAD中如何裁剪需要的区域
    Layui 使用问题汇总
    Instant Run 的操作影响到了代码,导致Android App启动闪退的问题
    Android studio百度地图demo出现230错误,key校验失败
    「小程序JAVA实战」小程序注册界面的开发(29)
    「小程序JAVA实战」小程序和后台api通信(28)
    「小程序JAVA实战」小程序多媒体组件(27)
    「小程序JAVA实战」小程序导航组件(26)
  • 原文地址:https://www.cnblogs.com/huangzizhu/p/7698648.html
Copyright © 2011-2022 走看看