iOS 10 选择本地图片时崩溃

更新日期: 2017-07-25 阅读次数: 5590 分类: iOS

错误信息为

[access] This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.

解决办法,Info.plist 文件中增加 NSPhotoLibraryUsageDescription 即可。需要注意,Info.plist 文件名字不是固定的,例如 Weex 中可能为 WeexDemo-Info.plist

--- a/platforms/ios/WeexDemo/WeexDemo-Info.plist
+++ b/platforms/ios/WeexDemo/WeexDemo-Info.plist
@@ -2,6 +2,8 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
+ <key>NSPhotoLibraryUsageDescription</key>
+ <string>此 App 需要您的同意才能读取媒体资料库</string>

关于作者 🌱

我是来自山东烟台的一名开发者,有敢兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊, 查看更多联系方式