HOW TO TYPE-CAST ABRECORDREF INTO NSNUMBER IN IOS

Anurag Sharma

Total Post:40

Points:280
Posted by  Anurag Sharma
 602  View(s)
Ratings:
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.

  1. Tarun Kumar

    Post:214

    Points:1642
    Re: How to type-cast ABRecordRef into NSNumber in iOS

    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)];

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!