#import <Foundation/Foundation.h> /// 几个对象互相引用,可能造成“保留环” @class EOCClassA; @class EOCClassB; @interface EOCClassA : NSObject @property (nonatomic , strong) EOCClassB *other; @end @interface EOCClassB : NSObject @property (nonatomic , strong) EOCClassA *other; @end @interface EOCClassWeak : NSObject @property (nonatomic , weak) EOCClassA *otherA;//当实例回收后,weak属性指向nil @property (nonatomic ,unsafe_unretained) EOCClassB *otherB;//仍然指向已回收的实例 @end #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end