【发布时间】:2018-11-07 22:24:06
【问题描述】:
我在 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];
}
【问题讨论】:
标签: ios objective-c