iOS app相机访问被拒绝iOS 9.1(黑屏) [英] iOS app camera access denied iOS 9.1(black screen)
问题描述
我想在我的应用中访问相机。我正在尝试以下代码。
I want to access camera in my app. I am trying the following code.
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera])
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
if(isIOS8SystemVersion)
{
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self presentViewController:picker animated:YES completion:NULL];
}];
}
else
{
[self presentViewController:picker animated:YES completion:NULL];
}
}
此代码完全适用于我的其他应用。但是这个应用程序,它不是要求相机权限或在settings-> privacy-> camera中显示它。
This code works on my other app perfectly.But in this app,it is not asking camera permissions or showing it in the settings->privacy->camera.
该应用程序提示使用该位置。但没有显示相机或照片的任何内容。
The app prompts to use the location.But not showing anything for the camera or photos.
黑屏如果我在没有条件检查的情况下直接使用相机代码,我就无法拍照。
The black screen appears and I can't take the picture if I directly use the camera code without the condition check.
推荐答案
我确切地说几天相同的问题,
I had the exactly same issue for couple of days,
试试这个解决了我的问题,确保有一个值
Try this its solved my problem, make sure that there is a value
(应用程序名称为字符串)在info.plist>Bundle display name中。
(Application name as string) in your info.plist > "Bundle display name".
在我的情况下它是空的,因为它不起作用。
In my case it was empty and because of that it didn't work.
让我知道它是否对你有帮助。
let me know if it helped you.
这篇关于iOS app相机访问被拒绝iOS 9.1(黑屏)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!