![](/img/trans.png)
[英]Why am I getting this warning about my app delegate and CLLocationManageDelegate?
[英]Why am I seeing a message warning about NSAutoreleasePool being unavailable?
知道為什么我收到這些消息:
NSAutoreleasePool不可用:在自動引用計數模式下不可用
ARC禁止“發布”的顯式消息發送
在這段代碼中:
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
是的,您啟用了自動引用計數,這不允許您明確使用'release'。 您需要禁用ARC或將主方法更改為如下所示:
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
在targets-> Build settings-> Apple LLVM Complailer 3.0下
Objective-C垃圾收集(更改為)支持[-fobjc-gc]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.