我在xcode和错误中使用此代码"' NSAutoreleasePool'不可用:在自动参考计数模式下不可用"正在显示。在最新的xcode版本中编写此代码的正确方法是什么。
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog(@"Base class Person Object");
Person *person = [[Person alloc]initWithName:@"Raj" andAge:5];
[person print];
NSLog(@"Inherited Class Employee Object");
Employee *employee = [[Employee alloc]initWithName:@"Raj" andAge:5 andEducation:@"MBA"];
[employee print];
[pool drain];
}
答案 0 :(得分:0)
您正在使用ARC模式ON代码(启用自动参考),首先您必须通过Xcode的设置禁用它,请参阅下面的讨论: