【发布时间】:2011-11-16 22:27:23
【问题描述】:
我正在尝试将指针传递给指向方法的指针,但显然 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;
【问题讨论】:
-
检查这个 [stackoverflow.com/questions/8814718/… 以及,这将澄清大部分疑问
标签: objective-c pointers ios5 automatic-ref-counting