iOS应用程式相机存取遭拒iOS 9.1(黑色画面)** [已解决] ** [英] iOS app camera access denied iOS 9.1(black screen) **[solved]**

查看:246
本文介绍了iOS应用程式相机存取遭拒iOS 9.1(黑色画面)** [已解决] **的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

此代码适用于我的其他应用程序。这个应用程序,它不是要求相机权限或显示在设置 - >隐私 - >相机。





应用程式会提示您使用位置。不会显示相机或相片的任何内容。



解决方案

我已经准确地使用了相机代码同一问题几天,



尝试这解决我的问题,确保有一个值





在我的情况下,它是空的,因为它没有工作。



让我知道它是否对您有帮助。


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

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

(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应用程式相机存取遭拒iOS 9.1(黑色画面)** [已解决] **的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆