dealloc UIImagePickerController错误

时间:2016-01-07 01:55:40

标签: ios objective-c

我有一个包含按钮图像选择器的视图。当我关闭视图时,我也在解除分配UIImagePickerController。

@interface XXPictureCell()<UIImagePickerControllerDelegate>
@property (nonatomic, strong) UIImagePickerController *imagePickerController;
@end

@implementation XXPictureCell
- (void)dealloc
{
    self.imagePickerController.delegate = nil;
}

//...

- (UIImagePickerController *)imagePickerController
{
    if (!_imagePickerController)
    {
        _imagePickerController = [[UIImagePickerController alloc] init];

        _imagePickerController.delegate = self;
        _imagePickerController.allowsEditing = YES;
        _imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
        _imagePickerController.cameraDevice = UIImagePickerControllerCameraDeviceFront;
    }
    return _imagePickerController;
}
@end

我一直收到的错误是

Cannot form weak reference to instance (0x7fa9e18dc600) of class XXPictureCell. It is possible that this object was over-released, or is in the process of deallocation.

0 个答案:

没有答案