ABMultiValueRef内存泄漏?

时间:2011-09-22 22:38:19

标签: iphone memory-leaks abaddressbook

当我使用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);

1 个答案:

答案 0 :(得分:1)

我从使用NSString *切换到CFString + CFRelease,这似乎可以解决问题。分析师仍然抱怨,但它似乎在Profile - &gt;下运行良好。泄漏。