I have found a lot of developers having problems adding the facebook iOS sdk code to a project that has Automatic Reference counting. Most of the suggested workaround are adding number of compiler flags to your project , but there is a better way handling this. The SDK is provided with a project file that allow you to compile a static library to be used. when using the static library that is already compiled , your project target is compiled separately to the SDK allowing you to optimize your own code separated from the SDK. To active that , download the SDK as described on the Facebook developers site  .

Once downloaded open the project and drag the src folder to your project in Xcode:

When you release the drag Xcode will prompt you on how you would like to add the files :

make sure you select Copy items ( since Facebook project file hold links to it file on same location) and de-select  the “Add to Target” you should get the group add like this:

then go to your project file info tab and scroll all the way down to the link libraries list :

click the + sign and choose the Facebook-ios-sdk library :

that is it.

when you want to update the source file and re compile just the library you can choose to compile from your schema drop down

working this way allow you to build from source and version of the SDK and also once the source will be ARC enabled it will also work and you won’t need to change a thing.

Happy coding.

About these ads