Any idea why I get these messages:
NSAutoreleasePool is unavailable: not available in automatic reference counting mode
ARC forbids explicit message send of 'release'
in this code:
#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;
}
This is because you are compiling with Automatic Reference Counting on. You need to use a different construct with ARC:
@autoreleasepool {
// Your code
}
Another option is to turn off ARC for a specific file .
Yeah, you have Automatic Reference Counting enabled, which doesn't allow you to explicitly use 'release'. You need to either disable ARC or change your main method to look like this:
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
Under targets->Build settings->Apple LLVM Complailer 3.0
Objective-C Garbage Collection (change to ) Supported [ -fobjc-gc]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.