How to type-cast ABRecordRef into NSNumber in iOS

Total Post:40

 805  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.

  1. Post:214

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

      Modified On Apr-10-2018 06:21:16 AM



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