0
ABMultiValueRef phonesRef = ABRecordCopyValue(person, kABPersonPhoneProperty);
for (int i=0; i < ABMultiValueGetCount(phonesRef); i++)
{
CFStringRef currentPhoneLabel = ABMultiValueCopyLabelAtIndex(phonesRef, i);
CFStringRef currentPhoneValue = ABMultiValueCopyValueAtIndex(phonesRef, i);
if (currentPhoneLabel != nil && currentPhoneValue != nil)
{
if (CFStringCompare(currentPhoneLabel, kABPersonPhoneMobileLabel, 0) == kCFCompareEqualTo)
{
[contactInfoDict setObject:(__bridge NSString *)currentPhoneValue forKey:@"workNumber"];
}
if (CFStringCompare(currentPhoneLabel, kABHomeLabel, 0) == kCFCompareEqualTo)
{
[contactInfoDict setObject:(__bridge NSString *)currentPhoneValue forKey:@"homeNumber"];
}
}
else if (currentPhoneValue != nil && currentPhoneLabel == nil)
{
[contactInfoDict setObject:(__bridge NSString *)currentPhoneValue forKey:@"workNumber"];
}
CFRelease(currentPhoneLabel);
CFRelease(currentPhoneValue);
}
CFRelease(phonesRef);
這裏是我的導入聯繫人電話到我的iOS應用程序的代碼,但是當currentPhoneLabel是CFRelease(currentPhoneLabel)零xocde。 我不知道爲什麼會發生。 任何幫助將是非常可觀的。CFStringRef釋放帶來壞訪問時,它是零
感謝
我從下面計算器的答案是指其中約內存釋放,通過您的崩潰日誌,如果該標籤中沒有數據,它如何釋放內存?它應該是崩潰的權利? http://stackoverflow.com/questions/17959760/do-i-need-to-manually-release-cfstringref –