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
    來源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
  • 相关阅读:
    SOUI开发者论坛
    第二十五篇:在SOUI中做事件分发处理
    第二十四篇:导出SOUI对象到LUA脚本
    第二十三篇:在SOUI中使用LUA脚本开发界面
    第四章:为妹子镶上璀璨的珠宝
    第三章:为妹子重塑婀娜身段
    第二章:美丽的幻想灰飞烟灭
    第一章:描绘妹子的靓影
    拥抱ARM妹子 序章!ARM妹子~~ 哥我来啦!
    一个比较方便的关闭进程函数
  • 原文地址:https://www.cnblogs.com/huangzizhu/p/7698648.html
Copyright © 2011-2022 走看看