2011-09-22 53 views
0

當我使用儀器時,它抱怨在emailProperty上發生內存泄漏。分析儀抱怨mobileLabel。代碼片段如下。鑑於我使用的版本和CFRelease,它有抱怨的原因有明顯的原因嗎?預先感謝您的回覆。ABMultiValueRef內存泄漏?

// 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

我從使用NSString *切換到CFString + CFRelease,這似乎是訣竅。分析儀仍然抱怨,但它似乎運行良好在配置文件 - >泄漏。