IPhone ARC & Facebook SDK

I get all kinds of build errors using the Facebook SDK because my application uses ARC. I try to delete Facebook files from the compiler to avoid this, but I get an Apple Mach-O error while deleting the Facebook.m file. If I get it back to compilation sources, I get ARC errors.

Does anyone come across this?

+6
source share
4 answers

Do you exclude them from the arc using the flag Compiler -fno-ObjC-arc? You can see the answer here.

+9
source

And that's why distributing a shared library by copying and pasting files is Bad . The library should be distributed as your own Xcode projects with the goal of a static library, so the requirements for customizing the build of your projects and the libraries you use cannot spoil one or the other.

Here you will find the error for the Facebook SDK: https://github.com/facebook/facebook-ios-sdk/issues

And at the same time, add the -fno-objc-arc flag to the implementation files in the Facebook SDK. You can do it:

  • Choose the goal of your application.
  • Click the Build Phases tab.
  • Add for each file in the section "Compilation Sources".
+5
source

The new SDK clearly does not support ARC out of the box, but there is a shell script to create a static library that can be used in your ARC project. Just go to your local git repository and run

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

This will create a static library in the / lib / facebook -ios-sdk folder (e.g. ~ / facebook-ios-sdk / lib / facebook-ios-sdk). You can then drag the facebook-ios-sdk folder to the Xcode application project to enable the iOS Facebook SDK static library.

+2
source

in fact, very few changes are needed to connect to iOS sdk Facebook with ARC. I made changes to my code, but I don’t know to whom to send it back to the community, any pointers?

here is a post I made to explain how to use it with ARC in an easy way in Xcode 4.2: http://nabtech.wordpress.com/2012/02/02/facebook-ios-sdk-and-arc/

0
source

Source: https://habr.com/ru/post/903326/


All Articles