简体   繁体   English

甚至在定义了关键NSPhotoLibraryUsageDescription的情况下访问iPhone照片库时,iOS应用程序也会崩溃

[英]iOS app crash when accessing iPhone photo library even with key NSPhotoLibraryUsageDescription defined

I have an application that I am updating to Xcode 8.2.1. 我有一个要更新到Xcode 8.2.1的应用程序。 Previously the access to the Camera and the Photo Library was working correctly. 以前,对相机和照片库的访问正常。 But now the app crashes with the following message : 但是,现在该应用程序崩溃并显示以下消息:

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.

Many posts on stackoverflow just says "add NSPhotoLibraryUsageDescription key" to your info.plist . 关于stackoverflow的许多帖子仅在您的info.plist说“添加NSPhotoLibraryUsageDescription键”。

But i have done such a thing ! 但是我做过这样的事情! And my app still crashes ! 而且我的应用仍然崩溃!

My info.plist file : 我的info.plist文件:

<key>NSLocationWhenInUseUsageDescription</key>
<string>Permet à l'application de connaitre l&apos;emplacement de vos posts</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) uses photos</string>
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) uses camera</string>
<key>CFBundleDevelopmentRegion</key>

The code is mainly based on a Apple example ... 该代码主要基于Apple示例...

- (IBAction)showImagePickerForPhotoPicker:(id)sender
{
    [self showImagePickerForSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}
- (void)showImagePickerForSourceType:(UIImagePickerControllerSourceType)sourceType
{
    // ...
    UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
    imagePickerController.sourceType = sourceType;
    imagePickerController.delegate = self;

    if (sourceType == UIImagePickerControllerSourceTypeCamera)
    {
    // ..
    }

    self.imagePickerController = imagePickerController;
    [self presentViewController:self.imagePickerController animated:YES completion:nil];
}

Well, I am really stuck ... Maybe it's a project configuration problem ? 好吧,我真的很困惑……也许是项目配置问题?

我很抱歉,但是这是我的错,在迁移时,我对info.plist文件有些混乱。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 访问iPhone照片库时,iOS Webview应用程序崩溃 - iOS webview app crash when accessing iPhone photo library 尽管 NSPhotoLibraryUsageDescription 应用程序崩溃 - App Crash despite NSPhotoLibraryUsageDescription Ionic iOS 应用商店上传错误 NSPhotoLibraryUsageDescription Key - Ionic iOS App store upload error NSPhotoLibraryUsageDescription Key 使用UIImagePickerController访问照片库后崩溃 - crash after accessing photo library using UIImagePickerController 从照片库中选择时,应用程序使iPhone Sim崩溃 - App crashes iPhone Sim when selecting from Photo Library iOS React Native应用程序崩溃NSPhotoLibraryUsageDescription - iOS React Native app crashes NSPhotoLibraryUsageDescription 从iOS应用访问iOS崩溃报告 - Accessing iOS crash report from iOS app 尝试通过Facebook iOS Graph API使用应用程序范围的用户ID获取用户照片时,应用程序崩溃 - app crash when try get user photo by Facebook iOS Graph API with app-scoped user id iOS 9.3无法使用在iPad上运行的iPhone应用程序从照片库中获取缩略图 - iOS 9.3 can not get thumbnail from photo library using iPhone App running on iPad 在iPhone 4S拍照时Safari崩溃[iOS 8.1] - Safari crash while taking photo in iPhone 4S [iOS 8.1]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM