我的项目快结束了,尽管在 XCode 中分析我的项目后,它向我表明这一行存在内存泄漏:
以下是相关代码的文本版本:
- (void)displayPerson:(ABRecordRef)person
{
NSString* firstName = (__bridge_transfer NSString*)ABRecordCopyValue(person, kABPersonFirstNameProperty);
NSString *lastName = (__bridge_transfer NSString*)ABRecordCopyValue(person, kABPersonLastNameProperty);
NSMutableString *fullName = [NSString stringWithFormat:@"%@ %@", firstName, lastName];
//NSLog(@"%@", fullName);
NSString* phoneNum = nil;
ABMultiValueRef phoneNumbers;
phoneNumbers = ABRecordCopyValue(person,
kABPersonPhoneProperty);
if (ABMultiValueGetCount(phoneNumbers) > 0) {
phoneNum = (__bridge_transfer NSString*) ABMultiValueCopyValueAtIndex(phoneNumbers, 0);
} else {
phoneNum = @"Unknown";
}
NSLog(@"First name is %@ and last name is %@", firstName, lastName);
NSLog(@"Phone is %@", phoneNum);
phoneNum = [phoneNum stringByReplacingOccurrencesOfString:@"(" withString:@""];
phoneNum = [phoneNum stringByReplacingOccurrencesOfString:@")" withString:@""];
谁能帮我解决这个问题?我不相信这会造成严重后果,但我不想给苹果一个理由拒绝我的应用程序从商店。谢谢你。
最好的...SL