@autoreleasepool { NSObject *obj = [[NSObject alloc] init]; }
以上代码在ARC模式下,obj对该对象有强引用,一旦出了这个作用域,强引用失效,对象被销毁。同时该对象又被注册到autoreleasepool中,因为出了autoreleasepool的作用域,对象岂不是又要销毁一次???
认证高级PHP讲师
The scope of obj is the scope of the automatic release pool. It will not be used twice. After adding @autoreleasepool, the object is placed in the release pool
The scope of obj is the scope of the automatic release pool. It will not be used twice. After adding @autoreleasepool, the object is placed in the release pool