2

I am trying to get all contacts from contacts book and then use them after processing according to the requirement .

I am collecting the name and numbers of all contacts using .....

NSString *strFNm=(NSString *) ABRecordCopyValue(ref,kABPersonFirstNameProperty);

ABMultiValueRef phoneNumbers = ABRecordCopyValue(ref, kABPersonPhoneProperty);

and I am adding each name and contacts to 2 separate arrays.

This all thing works correctly in simulator names and arrays in array (displayed with NSLog) however when I try to check the same thing in device array is always empty ... there is nothing in the array. (The contact book in device is having 127 contacts).

If any one has some solution on this please do write to this thread.

Abdel Raoof Olakara
  • 19,223
  • 11
  • 88
  • 133
user968597
  • 1,164
  • 2
  • 15
  • 30

1 Answers1

0

It seems you are not requesting for the permission to access the address book,on device it is mandatory to have access permission.

Refer to: Programmatically Request Access to Contacts

Community
  • 1
  • 1
Prasanna
  • 945
  • 10
  • 24