IOS7中的UIImagePickerController快照未呈现的视图会导致空快照

时间:2013-10-30 22:30:40

标签: ios

当我在IOS7.0.3中使用UIImagePickerController时,它似乎抛出一个错误“快照一个尚未渲染的视图导致空快照”。我的代码如下所示

-(void) showCamera
{
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
    {
        UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
        imagePicker.delegate = self;
        imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
        imagePicker.showsCameraControls = YES;

        [self presentViewController:imagePicker animated:YES completion:nil];
    }
}

委托方法是

- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{

    [self dismissViewControllerAnimated:YES
                             completion:nil];

    NSString *mediaType = info[UIImagePickerControllerMediaType];

       UIImage *image = nil;
    if ([mediaType isEqualToString:(__bridge NSString *)kUTTypeImage])
    {

        image = info [
                       UIImagePickerControllerOriginalImage];

    }


    if(picletImage != nil)
    {
        self.imageView.image = image;

    }

}

我不知道这里有什么不对,但这似乎在iPad上工作正常。我阅读了很多文章,但没有得到解决方案。我在仪器中进行了验证,似乎是在相机初始化期间或捕获图像时发生的内存泄漏。过去4天我一直坚持这一点,有人可以帮助我解决出错的问题,也可以解决这个问题。

0 个答案:

没有答案