第一次升级到Lion后,使用XCode4,只是写了一个demo,就有编译错误。
我写的代码是以下两句:
NSArray * a = [[NSArray alloc] init];
[a release];
报的错误提示是:
ARC forbids explicit message send of 'release'
'release' is unavailable: not available in automatic reference counting mode
解决办法:
打开当前工程,打开"Build Settings",找到Objective-C Automatic Reference Counting项,将它的值设置为NO。
再次编译,就消除了这个错误了。