Search code examples
iosstatic-linkingfacebook-ios-sdkrubymotion

Use Facebook SDK in RubyMotion app


I am trying to include the Facebook SDK in my rubymotion app, and I get the following error:

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ASIdentifierManager", referenced from: objc-class-ref in FacebookSDK(FBSettings.o) "_OBJC_CLASS_$_SLComposeViewController", referenced from: objc-class-ref in FacebookSDK(FBNativeDialogs.o) "_SLServiceTypeFacebook", referenced from: +[FBNativeDialogs composeViewControllerWithSession:handler:] in FacebookSDK(FBNativeDialogs.o) ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) rake aborted! Command failed with status (1): [/Applications/Xcode.app/Contents/Developer...]

I have tried adding it both through the cocoapod "Facebook-iOS-SKD"

 app.pods do 
   pod "Facebook-iOS-SDK"
 end

And as a vendor project

app.vendor_project('vendor/FacebookSDK.framework', :static, :products => ['FacebookSDK'], :headers_dir => 'Headers')

What am I doing wrong here? How do I get it to link correctly?


Solution

  • Since the Facebook SDK 3.1 has frameworks that are iOS 6 specific, I had to specify those frameworks as 'weak' in the Rakefile.

    app.weak_frameworks += %w(AdSupport Social)
    

    Credit goes to Laurent Sansonetti for the fix.