当我使用Instruments时,它会抱怨emailProperty上有内存泄漏。分析器抱怨mobileLabel。代码片段如下。鉴于我使用release和CFRelease,是否有一个明显的原因让它抱怨?提前感谢任何回复。
// Email is a multi value property, take "Home"
ABMultiValueRef emailProperty = ABRecordCopyValue(person, kABPersonEmailProperty);
NSString *email;
NSString *mobileLabel;
for (CFIndex i = 0; i < ABMultiValueGetCount(emailProperty); i++)
{
mobileLabel = (NSString *)ABMultiValueCopyLabelAtIndex(emailProperty, i);
if ([mobileLabel isEqualToString:@"_$!<Home>!$_"])
{
email = (NSString *)ABMultiValueCopyValueAtIndex(emailProperty,i);
self.emailAddress.text = email;
self.emailAddress.enabled = NO;
self.emailAddress.borderStyle = UITextBorderStyleNone;
[email release];
break;
}
[mobileLabel release];
}
CFRelease(emailProperty);
答案 0 :(得分:1)
我从使用NSString *切换到CFString + CFRelease,这似乎可以解决问题。分析师仍然抱怨,但它似乎在Profile - &gt;下运行良好。泄漏。