This app has crashed because it attempted to access privacy-sensitive data without a usage

After upgrading to iOS 10, the following prompt will often appear when Xcode runs the project, causing the app to crash:
This app has crashed because it attempted to access privacy-sensitive data without a usage description.

Don't worry, this is caused by permissions

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

Album permissions

As mentioned above, The app's Info.plist must contain an NSPhotoLibraryAddUsageDescription… That is, when saving pictures to the album in iOS, you need to apply to the system for permission to access the album

 ///保存 Image 到系统相册中
 UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);

Just add the permission application description file to the info.plist in your xcode project directory as follows:

    <key>NSCameraUsageDescription</key>
    <string>请允许APP访问您的相机</string>
    <key>NSPhotoLibraryAddUsageDescription</key>
    <string>请允许APP保存图片到相册</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>请允许APP访问您的相册</string>

Guess you like

Origin blog.csdn.net/zl18603543572/article/details/108543146