Under ARC,
if I define a ivar like this:
@interface ObjectA : NSObject {
id A;
}
@property(nonatomic,unsafe_unretained) id A;
What’s the property of A? strong or unsafe_unretained?
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.
It depends on how you implement it. There are two ways you can go about doing it:
@synthesize A;or@synthesize A = __A;In this case it’s__unsafe_unretained, because the ownership spec of the property trumps the ownership spec of the ivar1.AandsetA. In this case, the result will depend on the kind of backing variable that you choose for your implementation.2Here is a link to the documentation that spells out the rules of how the ownership of properties is determined. See Section 4.1.1.