Using Non-ARC Code in an ARC-Enabled Project - Adding Facebook

12,863

Solution 1

Make sure that you added the -fno-objc-arc flag to each implementation file (.m file).

And then clean the project (Project menu -> clean) and build again. I have sometimes had to clean and build twice when doing this in class. Seems like a little bug.

Solution 2

there is actually a much easy way working in mixed ARC and Facebook none ARC . see my post on how to use it http://nabtech.wordpress.com/2012/02/02/facebook-ios-sdk-and-arc/

Share:
12,863
Illep
Author by

Illep

I love writing code.

Updated on June 14, 2022

Comments

  • Illep
    Illep almost 2 years

    When i created my project, i made it to support ARC, so my project will support iOS 4.3 and above.

    Now i need to integrate Twitter and Facebook to it. Both Facebook and Twitter frameworks given by the companies does not support ARC.

    Most of the files have dealloc, and released its variables. Some say to scrap the project and redo it disabling ARC. But, i can't afford to do this, since i have done most of the stuff.

    I added the FBConnect files (there were 4 of them) and added -fno-objc-arc as described in this tutorial. Still i get

    file://localhost/Users/illepmorgan/Documents/Projects/illep/untitled%20folder/alphaproject/alphaproject/FBRequest.m: error: Automatic Reference Counting Issue: Existing ivar '_delegate' for unsafe_unretained property 'delegate' must be __unsafe_unretained
    

    I need help, i can't redo this again.

  • Illep
    Illep over 12 years
    You will also have to add the JSON files (which are in a folder). So do i have to add the flag for those files as well ? The JSON files were not identified in the target to add the flag. What should i do now ?
  • Firoze Lafeer
    Firoze Lafeer over 12 years
    JSON files are not objective-c code, and you won't compile them, so this flag doesn't apply.
  • Illep
    Illep over 12 years
    well, FBConnect the Facebook framework has a JSON folder and when you look in that you will find a lot of Objective-C code. So do i have to flag them too ?
  • Firoze Lafeer
    Firoze Lafeer over 12 years
    Yes, any objective-c implementation files (.m), regardless of folder.