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 6690517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:38:47+00:00 2026-05-26T05:38:47+00:00

I recently started a new project using Automatic Reference Counting (ARC). When I assigned

  • 0

I recently started a new project using Automatic Reference Counting (ARC).
When I assigned the contents of a CALayer:

UIView* view = ...
UIImage* image = ...
view.layer.contents = image.CGImage

I got an error

Implicit conversion of a non-Objective-C pointer type ‘CGImageRef’ to ‘id’ is disallowed with ARC

Simply casting the CGImageRef to id hides the error, but I was wondering if the ARC still functions correctly then?

  • 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-05-26T05:38:47+00:00Added an answer on May 26, 2026 at 5:38 am

    You should really check out the ARC videos from WWDC 2011. They are available on the developer site and open through iTunes. Especially:

    • Session 323 – Introducing Automatic Reference Counting

    • Session 322 – Objective-C Advancements in Depth

    Also, the ARC reference notes:

    https://developer.apple.com/library/content/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html

    Both the reference notes and the videos discuss Core Graphics (et al) and how they work with ARC.

    Specifically, look at the section called "Managing Toll-Free Bridging"

    In many Cocoa applications, you need to use Core Foundation-style objects, whether from the Core Foundation framework itself (such as
    CFArrayRef or CFMutableDictionaryRef) or from frameworks that adopt
    Core Foundation conventions such as Core Graphics (you might use types
    like CGColorSpaceRef and CGGradientRef).

    The compiler does not automatically manage the lifetimes of Core
    Foundation objects; you must call CFRetain and CFRelease (or the
    corresponding type-specific variants) as dictated by the Core
    Foundation memory management rules (see Memory Management Programming
    Guide for Core Foundation).

    If you cast between Objective-C and Core Foundation-style objects, you
    need to tell the compiler about the ownership semantics of the object
    using either a cast (defined in objc/runtime.h) or a Core
    Foundation-style macro (defined in NSObject.h): […]

    Jörg Jacobsen has a good summary overview of the bridging options as well: Managing Toll-free Bridging in an ARC’ed Environment.

    __bridge_retained (n.b.: only use it when casting from object pointer to C type pointer): I (the programmer) need to reference this object
    for some time in the dark world of C type pointers which is opaque to
    you, ARC. So please, please do not release this object while I still
    need it. I (the programmer) promise to release it myself (in the dark
    world) when I’m done with it

    __bridge_transfer (n.b.: only use it when casting from C type pointer to object pointer): I (the programmer) hand over to you, ARC, an
    object that I own and that I am no longer interested in in the dark
    world of C type pointers that is opaque to you. Whenever you, ARC, are
    done with that object please release it yourself, because you know the
    right time and thus save me some work not having to do it myself.

    __bridge: ARC, you keep balancing out your retains and releases as I keep balancing out mine in the dark world of C type pointers which
    is…. Whenever I need to hold on to an object in the dark world I will
    retain it myself and release it when appropriate. I don’t need any
    extra contract with you, ARC.

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

Sidebar

Related Questions

I've just recently started using VS2008 for a new tools project, and have been
I recently started at a new position where the project is being developed using
I've recently started work on a new project using EpiServer which I am totally
I've recently started work on a new project using PHP5 and want to use
I recently started a new project using iOS 5 with UIStoryBoards (awesome feature;)). Especially
I recently started a new webforms project and decided to separate the business classes
I recently started work on a personal coding project using C++ and KDevelop. Although
I've recently started a new web development project for an embedded device and wanted
I have recently started using a shared-host for my clients so see project progress
I have recently started a new C++ project and I intend to make it

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.