Here is my code to get Notes from AddressBook.
+(NSString*)getNote:(ABRecordRef)record {
return ABRecordCopyValue(record, kABPersonNoteProperty);
}
But in above implementation I have memory leak. So to remove memory leak I wrote following code
+(NSString*)getNote:(ABRecordRef)record {
NSString *tempNotes = (NSString*)ABRecordCopyValue(record, kABPersonNoteProperty);
NSString *notes = [NSString stringWithString:tempNotes];
[tempNotes release];
return notes;
}
If I write above code my app crashes. Whats going wrong? Thanks.
UPDATE: I call this method as follows :
notes = [AddreesBook getNote:record];
where notes is my ivar & I am releasing it in dealloc method.