Home > DeveloperSection > Forums > How to type-cast ABRecordRef into NSNumber in iOS
Anurag Sharma
Anurag Sharma

Total Post:40

Posted on    December-02-2015 7:14 AM

 iPhone iPhone  Ios  Objective C 

 1 Reply(s)
 540  View(s)
Rate this:
I have successfully get device contact ID using this code:
ABRecordRef contactPerson = (__bridge ABRecordRef) allContacts[i];
but now my problem is how can I type-cast ABRecordRef value into NSNumber.
How can I solve this problem.

Tarun Kumar

Total Post:214

Posted on    December-06-2015 10:50 PM

First of all, the code you are specifying here,

ABRecordRef contactPerson = (__bridge ABRecordRef) allContacts[i];

this code is used for fetching person contacts one by one.

after that we we will get Id of that person using contactPerson. Here I am providing that code which will fetch Id and type-cast into NSNumber:

NSNumber *contactId = [NSNumber numberWithInt:ABRecordGetRecordID(contactPerson)];

Don't want to miss updates? Please click the below button!

Follow MindStick