@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

相关文章:

  • 2021-06-09
  • 2021-09-04
  • 2022-12-23
  • 2021-04-24
  • 2022-12-23
  • 2021-10-04
猜你喜欢
  • 2022-01-14
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
  • 2021-10-15
  • 2022-01-09
  • 2021-10-08
相关资源
相似解决方案