0

I am issue while accessing the address book of user. My code is

ABMultiValueRef email = ABRecordCopyValue(aSource, kABPersonEmailProperty);
        NSString* email_lbl;
        for(CFIndex i = 0; i < ABMultiValueGetCount(email); i++) {
            email_lbl = (NSString*)ABMultiValueCopyLabelAtIndex(email, i);
            if([email_lbl isEqualToString:(NSString *)kABHomeLabel])
            {
               home_email = [(NSString*)ABMultiValueCopyValueAtIndex(email, i)retain];
            }
            if([email_lbl isEqualToString:(NSString *)kABWorkLabel])
            {
               work_email = [(NSString*)ABMultiValueCopyValueAtIndex(email, i)retain];
            }
            if([email_lbl isEqualToString:(NSString *)kABOtherLabel])
            {
                basic_email = [(NSString*)ABMultiValueCopyValueAtIndex(email, i)retain];
            }

        }

There is Exc_bad_access signal received when I to log the home_email, work_email, basic_email.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
ankit mehta
  • 23
  • 1
  • 6

1 Answers1

0

I found the solution for this my self. I declared the home_email, work_email, basic_email but didn't initialized them and by the time i was printing them in log those were not initialized. This solved my issue.

ankit mehta
  • 23
  • 1
  • 6