Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9210237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:01:26+00:00 2026-06-18T01:01:26+00:00

I start learning programming with Objective-C, and do not have much knowledge of C.

  • 0

I start learning programming with Objective-C, and do not have much knowledge of C. So, bridge casting in iOS 6 is still somewhat confusing for me.

Here is the scenario:

I have a person ABRecordID stored in CoreData as ‘NSNumber’ attribute. Later on, I would like to access to that person directly, so I want to use the person’s ABRecordID to access the contact info using ABAddressBook. Noticed that ABAddressBookGetPersonWithRecordID needs ABRecordID, below is how I perform casting in my code…

address_book = ABAddressBookCreate();
ABRecordID rec_id = (__bridge ABRecordID)person.record_id;

However, This was not successful and I was given incompatible types casting 'int' into 'ABRecordID' (aka 'int') with a __bridge cast.

Already confused as it is, what would be a proper way to bridge cast between ARC type and CF type?

Also, in which case should I use (__bridge retained) instead of (__bridge)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:01:27+00:00Added an answer on June 18, 2026 at 1:01 am

    The ABRecordID is a synonym (typedef) for int32_t which is a 32-bit integer. So typecasting is not the proper approach. You want to create an NSNumber with the value of the id.

    ABRecordId rec_id = person.record_id;
    NSNumber *wrapper = [NSNumber numberWithInt:(int)rec_id];
    

    and later:

    NSNumber *wrapper = ...
    ABRecordId rec_id = (ABRecordId)[wrapper intValue];
    

    Please note that bridging and ARC are irrelevant when going to/from ABRecordId and NSNumber. There is no use of any of the CF types in this case. You’ll know when you are using CF types because you’ll have a variable whose type begins with CF (such as CFArrayRef).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to programming and stackoverflow and have decided to start by learning objective
To start off, I am still learning object oriented programming. Ok, I have a
Up to now in my programming career (two years) I have not had much
I want to start learning objective-c with book: Programming in Objective-C (4th Edition) .
Does it make sense to start learning JavaFx if I do not have any
I have decided to start programming some apps for the iPhone that eventually will
I have decided (whether it's for better or for worse), to start learning the
hi i am a student and just start learning low level c programming.i tried
I was programming in C ,... but some months ago I start learning .Net
I have been learning Objective-C as my first language and understand Classes, Objects, instances,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.