即時得到以下錯誤發送指針「的NSString * _strong *類型爲_unsafe_unretained ID參數*」改變保留/釋放性能
Sending "NSString *_strong*to parameter of type _unsafe_unretained id* "changes retain/release properties of pointer
......
:[theDict getObjects:values andKeys:keys];
我試着從聯繫人添加地址到我的應用程序。有人能向我解釋它的抱怨嗎?我認爲它是一個ARC問題,可能與手動內存管理有關?但我不確定如何解決它。
- (BOOL)peoplePickerNavigationController:
(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person
property:(ABPropertyID)property
identifier:(ABMultiValueIdentifier)identifier
{
if (property == kABPersonAddressProperty) {
ABMultiValueRef multi = ABRecordCopyValue(person, property);
NSArray *theArray = (__bridge id)ABMultiValueCopyArrayOfAllValues(multi);
const NSUInteger theIndex = ABMultiValueGetIndexForIdentifier(multi, identifier);
NSDictionary *theDict = [theArray objectAtIndex:theIndex];
const NSUInteger theCount = [theDict count];
NSString *keys[theCount];
NSString *values[theCount];
[theDict getObjects:values andKeys:keys]; <<<<<<<<< error here
NSString *address;
address = [NSString stringWithFormat:@"%@, %@, %@",
[theDict objectForKey: (NSString *)kABPersonAddressStreetKey],
[theDict objectForKey: (NSString *)kABPersonAddressZIPKey],
[theDict objectForKey: (NSString *)kABPersonAddressCountryKey]];
_town.text = address;
[ self dismissModalViewControllerAnimated:YES ];
return YES;
}
return YES;
}
這個要求不僅僅是'theDict'不會被釋放,而且任何鍵或值都不會被刪除或改變。 – Dani
@Dani - 是的,很好的說明。 – rmaddy
謝謝你一直堅持這一點。 – JSA986