Hi all,
@property (nonatomic, assign) NSInteger myindex;
this line changes to unsafe_unretained after performing a convertion to Objective C ARC can any one please explain me regarding this.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In your case it won’t change to
unsafe_unretainedbecause it is a scalar value.Probably you wrote like:
that’s why it is converting to
unsafe_unretained.In ARC
assignis effectivelyunsafe_unretained.For scalars values like
int,float. You can useassignitself.For objects you can use either
weakorunsafe_unretained, it depends on the context.unsafe_unretainedandweakprevent the retention of objects, but in slightly different ways.weakthe pointer to an object will convert to nil when the object is deallocated.unsafe_unretainedwill continue pointing to the memory where an object was, even after it was deallocated. This can lead to crashes due to accessing that deallocated object.