2017-02-06 9 views
0

Xcode 8.2.1にアップデートするアプリケーションがあります。以前は、カメラとフォトライブラリへのアクセスが正しく機能していました。しかし、今、次のメッセージでアプリがクラッシュする:StackOverflowの上キーのNSPhotoLibraryUsageDescriptionが定義されていてもiPhoneフォトライブラリにアクセスするとiOSアプリがクラッシュする

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ファイル:

<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> 

コードは主にアップルの例に基づいています...

- (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]; 
} 

まあ、私は本当に立ち往生しています...多分それは、プロジェクトの設定の問題ですか?

+1

あなたのプロジェクトを掃除してみてください。それでも問題が解決しない場合は、アプリを削除して再インストールしてください。 –

+1

この2つがうまくいかなくても、設定に行き、デバイスのプライバシー設定をリセットします。 –

+0

プロジェクトをクリーニングし、アプリを削除して再インストールしてください。動作しません...どのようにプライバシーの設定をリセットしますか? – franckfournier

答えて

0

私は謝罪しましたが、私はinfo.plistファイルでいくつか混乱していました。

関連する問題