关于 Xcode4.3 的 @autoreleasepool
xcode4.3引入ARC,release这块就有些变化,当你使用ARC,就必须将NSAutoreleasePool的地方换成 @autoreleasepool
@autoreleasepool {
// Code benefitting from a local autorelease pool.
}
@autoreleasepool blocks are more efficient than using an instance of NSAutoreleasePool directly; you can also use them even if you do not use ARC
就算你没有用ARC的时候你也可以使用@autoreleasepool.更加高效。
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
int i = 9;
// insert code here...
NSLog(@"Hello, World! %i",i);
}
return 0;
}
posted on 2013-12-12 20:00 阳光总在风雨后001 阅读(222) 评论(0) 收藏 举报
浙公网安备 33010602011771号