Tôi đang cố chuyển con trỏ tới con trỏ tới phương thức, nhưng dường như ARC có một số vấn đề với cách tôi đang thực hiện nó. Đây là hai phương pháp:Vấn đề đếm tham chiếu tự động: Chuyển địa chỉ của đối tượng không phải cục bộ tới tham số __autoreleasing để ghi lại
+ (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];
}
tôi nhận được lỗi sau:
Automatic Reference Counting Issue: Passing address of non-local object to __autoreleasing parameter for write-back
Trên dòng mà lệnh sau đây xuất hiện:
[self SHL_initPersonPropertyNamesWithArray:&propertyNames] : NULL;
Kiểm tra [https://stackoverflow.com/questions/8814718/handling-pointer-to-pointer-ownership-issues-in-arc?answertab=active#tab-top] này, điều này sẽ làm rõ hầu hết nghi ngờ – tharinduNA