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

  • Home
  • SEARCH
  • 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 7065817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:00:11+00:00 2026-05-28T05:00:11+00:00

In a ARC enabled project, is there a way to add the -fno-objc-arc tag

  • 0

In a ARC enabled project, is there a way to add the -fno-objc-arc tag programatically in the code it self.

So i could give my source files to someone else, and that person need not add the -fno-objc-arc manually.

  • 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-28T05:00:11+00:00Added an answer on May 28, 2026 at 5:00 am

    I assume this is because you want to distribute your project as a re-usable library that can be used in other projects regardless of whether they use ARC?

    I don’t think you can add the flag to the source to tell ARC to ignore the file (at least I’ve not found a way yet), but you can detect if ARC is enabled within the file using

    #if __has_feature(objc_arc)
    ...
    #endif
    

    You could use this to raise a warning, by saying

    #warning This file is not ARC compatible, add the -fno-objc-arc tag
    

    But an even more elegant solution is to use this feature to automatically branch your code at compile time so that it works on both ARC and non-ARC builds.

    I wrote a simple re-usable header that can be pasted into the top of your source file or included in the project as a standalone header file:

    https://gist.github.com/1563325

    This provides a bunch of macros to use instead of retain, release and autorelease methods so that they can be automatically stripped for ARC builds. For an example of how this is used, check out iRate:

    https://github.com/nicklockwood/iRate/tree/master/iRate

    It only takes a few minutes to convert a class file this way.

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

Sidebar

Related Questions

In my iOS ARC-enabled code, I need to pass self and other objects to
I'm getting a strange exception in Xcode 4.2.1 (ARC-enabled project) that I can't track
My project is ARC enabled (the build settings have Objective-C Reference Counting set to
I'm using the following code within XCode, building for iOS with ARC enabled. Why
I've enabled ARC, In my didFinishLaunchingWithOptions method, I wrote the following code: AppDelegate.h: @interface
In my iOS 5 project with ARC enabled, one of my objects gets released
If I run the following in a project where ARC is enabled the completion
I want to use CocosDenshion with my ARC enabled project but when I simply
I am working on an iOS SDK 4 project with ARC enabled. My class
I have the following code, which is causing a leak, despite ARC being enabled

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.