我正在尝试将指针传递给指向方法的指针,但显然 ARC 对我的操作方式存在一些问题。这里有两种方法:
+ (NSString *)personPropertyNameForIndex:(kSHLPersonDetailsTableRowIndex)index
{
static NSArray *propertyNames = nil;
(nil == propertyNames) ?
[self SHL_initPersonPropertyNamesWithArray:&propertyNames] : NULL;
}
+ (void)SHL_initPersonPropertyNamesWithArray:(NSArray **)theArray
{
*theArray = [[NSArray alloc]
initWithObjects:@"name", @"email", @"birthdate", @"phone", nil];
}
我收到以下错误:
自动引用计数问题:将非本地对象的地址传递给 __autoreleasing 参数以进行回写
在出现以下命令的行上:
[self SHL_initPersonPropertyNamesWithArray:&propertyNames] : NULL;