在两端的set方法中,有一端必须使用assign直接赋值,不能用retain;在@property中参数使用assign。
例如:
@interface Dog : NSObject
@property (nonatomic,assign) Person *owner;
@end
@interface Person : NSObject
@property (nonatomic,retain) Dog *dog;
@end
Person *p = [Person new];
Dog *d = [Dog new];
p.dog = d;
d.owner = p;
|