1

我从父类调用这个方法

图像选择器.m

- (void) imagePickerController:(UIImagePickerController *)thePicker didFinishPickingMediaWithInfo:(NSDictionary *)imageInfo
{

     UIImage *imag = [imageInfo objectForKey:@"UIImagePickerControllerOriginalImage"];
    NSData *imageData = UIImageJPEGRepresentation(imag,0.1);

    [parentviewcontroller requestToParentWithImage:imageData];
}

这里 parentviewcontroller 在 imagepicker.h 中声明

@property(strong,nonatomic)UIViewController<SmartretailDelegate> *parentviewcontroller;

任务列表数据.M

IMAG=[IMAGEPICKER alloc]init];
IMAG.parentviewcontroller=self;

我的问题是 parentviewcontroller 没有分配。它在哪里被释放/崩溃?

4

2 回答 2

1

'strong' attribute indicates that the parentviewcontroller object is retained and it will be deallocated when imagePicker object gets deallocated. For more information refer this link 'Objective-C ARC: strong vs retain and weak vs assign'.

于 2013-12-02T06:49:23.897 回答
0

听起来您需要更多地了解ARC(或自动引用计数)的工作原理

当你的“ IMAG”对象被 ARC 释放时,对 parentviewcontroller的强引用也会被释放。

于 2013-08-17T06:51:51.473 回答