iosobjective-cipadcameraios9.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];
                }
            }

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.

enter image description here

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.


Solution

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