效果图
项目代码地址
遇到的玄学问题
[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.
出现上述问题一般是因为授权没有打开导致的crash,常规做法是在info.plist中添加相机和相册的授权就应该解决,但是我这边发生了通过property list的方式添加不会出现授权提示,而通过source code方式打开直接代码添加就没有问题,至今不知道原因,所以权限的东西备注下,以后直接往里copy
![![![WeChatSight1.gif](https://upload-images.jianshu.io/upload_images/2310905-023da3059e719345.gif?imageMogr2/auto-orient/strip)
](https://upload-images.jianshu.io/upload_images/2310905-eb5556b13c0a824d.gif?imageMogr2/auto-orient/strip)
](https://upload-images.jianshu.io/upload_images/2310905-10248b46a0dfe17b.gif?imageMogr2/auto-orient/strip)
<!-- 相册 -->
<key>NSPhotoLibraryUsageDescription</key>
<string>App需要您的同意,才能访问相册</string>
<!-- 相机 -->
<key>NSCameraUsageDescription</key>
<string>App需要您的同意,才能访问相机</string>
<!-- 麦克风 -->
<key>NSMicrophoneUsageDescription</key>
<string>App需要您的同意,才能访问麦克风</string>
<!-- 位置 -->
<key>NSLocationUsageDescription</key>
<string>App需要您的同意,才能访问位置</string>
<!-- 在使用期间访问位置 -->
<key>NSLocationWhenInUseUsageDescription</key>
<string>App需要您的同意,才能在使用期间访问位置</string>
<!-- 始终访问位置 -->
<key>NSLocationAlwaysUsageDescription</key>
<string>App需要您的同意,才能始终访问位置</string>
<!-- 日历 -->
<key>NSCalendarsUsageDescription</key>
<string>App需要您的同意,才能访问日历</string>
<!-- 提醒事项 -->
<key>NSRemindersUsageDescription</key>
<string>App需要您的同意,才能访问提醒事项</string>
<!-- 运动与健身 -->
<key>NSMotionUsageDescription</key> <string>App需要您的同意,才能访问运动与健身</string>
<!-- 健康更新 -->
<key>NSHealthUpdateUsageDescription</key>
<string>App需要您的同意,才能访问健康更新 </string>
<!-- 健康分享 -->
<key>NSHealthShareUsageDescription</key>
<string>App需要您的同意,才能访问健康分享</string>
<!-- 蓝牙 -->
<key>NSBluetoothPeripheralUsageDescription</key>
<string>App需要您的同意,才能访问蓝牙</string>
<!-- 媒体资料库 -->
<key>NSAppleMusicUsageDescription</key>
<string>App需要您的同意,才能访问媒体资料库</string>
<key>NSContactsUsageDescription</key>
<string>App需要您的同意,才能访问通讯录</string>