Camera show black screen in ios 8

2019-04-11 09:14发布

This code for capturing image one by one from camera,but after taking one image next time camera will open but with black screen(like it,s shutter close).all other ios version its working,but not working in ios 8.please tell me how can i solve it?

-(void)openCamera
 {
   if(![PickerHandler doesDeviceSupportMediaType:ITEM_TYPE_PHOTO])
   {
    [PickerHandler showNoDeviceSupportWarningForMediaType:ITEM_TYPE_PHOTO withDelegate:self];
   }
   else 
   {
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;

    picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeImage];
    [self presentViewController:picker animated:YES completion:nil];
   }

 }

3条回答
forever°为你锁心
2楼-- · 2019-04-11 09:28

this code is not work in simulator.

UIImagePickerController *videoScreen = [[UIImagePickerController alloc] init];
    videoScreen.sourceType = UIImagePickerControllerSourceTypeCamera;

    videoScreen.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];

    videoScreen.allowsEditing = NO;
    videoScreen.delegate = self;

    [self presentViewController:videoScreen animated: YES completion:NO];
查看更多
仙女界的扛把子
3楼-- · 2019-04-11 09:42

Go to Settings > Privacy > Pictures ... and check if your app have permission.

In the code, use this to verify camera access.

- (BOOL)authorizedCameraAccess
{
    AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
    return  (status == AVAuthorizationStatusAuthorized);
}
查看更多
够拽才男人
4楼-- · 2019-04-11 09:45

Implement This method

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
 [self dismissViewControllerAnimated:NO completion:NO];
}
查看更多
登录 后发表回答