Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone ARC & Facebook SDK

I'm getting all kinds of build errors with Facebook's SDK because my app uses ARC. I try to remove the Facebook files from the compiler to avoid this, but I get an Apple Mach-O error when I remove the Facebook.m file. If I put that back in the compile sources, I get the ARC errors.

Anyone run into this?

like image 511
Eric Avatar asked Dec 07 '11 19:12

Eric


3 Answers

Do you exclude them from arc with Compiler flag -fno-objc-arc ? You can see a Answer here

like image 140
btype Avatar answered Nov 17 '22 03:11

btype


And this is why distributing a shared library by copy and pasting files is bad. A library should be distributed as it's own Xcode projects with a static library target, so that the build setting requirements of your projects and the libraries you use can not screw up one or the other.

File a bug for the Facebook SDK here: https://github.com/facebook/facebook-ios-sdk/issues

And in the mean time add the -fno-objc-arc flag to the implementation files in the Facebook SDK. You can do this by;

  1. Select your application target
  2. Go to the Build Phases tab
  3. Add for each file under the Compile Sources section.
like image 35
PeyloW Avatar answered Nov 17 '22 03:11

PeyloW


The new SDK does not explicitly support ARC out of the box, but there is a shell scrip to build a static library that can be used within your ARC project. Just navigate to your local git repo and run

% ~/facebook-ios-sdk/scripts/build_facebook_ios_sdk_static_lib.sh

This will create the static library under the /lib/facebook-ios-sdk folder (e.g. ~/facebook-ios-sdk/lib/facebook-ios-sdk). You may then drag the facebook-ios-sdk folder into the app Xcode project to include the iOS Facebook SDK static library.

like image 2
Edwin Avatar answered Nov 17 '22 04:11

Edwin