NaN
NaN

Reputation: 608

Objective C, replacement of retain while using ARC

I am trying convert a project which uses retain and release to use ARC. The automatic conversion in XCode didn't work out, so I do it by hand. Dealing with release was easy. I am now down to a couple of retain statements like below:

UIImage *origImage = [[info objectForKey:UIImagePickerControllerOriginalImage] retain];

How do I convert this to ARC friendly? I tried to use the strong keyword, but complier complained about Use of undeclared identifier 'strong'.

Upvotes: 0

Views: 479

Answers (2)

Kyle
Kyle

Reputation: 434

You want to use __strong which is the same as using strong for a @property, but for a variable. same with weak and __weak

__strong UIImage *origImage = [info objectForKey:UIImagePickerControllerOriginalImage];

Upvotes: 0

user529543
user529543

Reputation:

UIImage *origImage = [info objectForKey:UIImagePickerControllerOriginalImage] ;

it is ARC friendly.

Upvotes: 3

Related Questions