@interfaceAppDelegate()

{

NSObject * obj_;

}

@property(retain) NSObject * obj;// 默认是atomic

//@property(nonatomic, retain) NSObject * obj;

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

  obj_ = [[NSObject alloc] init];

id xx = self.obj; // 如果不是nonatomic,这里引用计数+1

    xx = self.obj; // 如果不是nonatomic,这里再+1.执行完这句后obj_的引用计数成了3

returnYES;

}

@end

05-02 04:08
查看更多