What happens if I create a property with “assign” attribute set the property to nil in dealloc method
@property (nonatomic, assign) NSString* myData;
- (void)dealloc {
self.myData = nil;
}
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.
then the setter is called which just sets the pointer to
niland nothing else happens.edit: difference between (nonatomic, assign) and (nonatomic, retain)
An
assign-property will only set the pointer and aretain-property will also call release on the old and retain on the new object.The synthesized
(nonatomic, assign)-setter will look like this:And the synthesized
(nonatomic, retain)-setter will look like this:Between the getters there is no difference. Both are just nonatomic.