2

So in my project I have the FacebookSDK, the ParseSDK and FirebaseSDK. Facebook and parse both need bolts, so I implemented that. However it will not compile unless I remove the -ObjC flag. The problem is that if I remove this tag, the code will compile, but It will cause a runtime error when trying to initialise Firebase because it requires -ObjC. I am in a mess. Can I set the flag only for that specific framework? Thanks for any help.

Alessandro
  • 4,000
  • 12
  • 63
  • 131
  • 1
    Not a direct answer to your question but I 100% recommend just using Cocoapods for these dependencies. It looks like Bolts is set up as a proper dependency in the other Facebook repos and should not cause any problems while saving you headache in general (importing and managing libraries manually is a waste of time when you can avoid it). – Dima Mar 16 '15 at 18:17
  • SFWdc I accepted your amswer, but finally I went for Cocoapods as dima suggested and that solved the error. Thanks Dima :)) – Alessandro Mar 23 '15 at 18:32

2 Answers2

4

( I think this should be a comment, but I don't have enough rep yet, hope this helps to solve this.)

I'm having the exact same problem (with SponsorPay SDK instead of FirebaseSDK), Facebook SDK & Parse work fine together until i add the -ObjC flag, needed by SponsorPay to work.

Deleting Bolts.framework is not the solution, since that gives some linking errors:

"_BFTaskMultipleExceptionsException", referenced from:

      ___53+[PFObject(Private) deleteAllAsync:withSessionToken:]_block_invoke214 in Parse(PFObject.o)

      ___65+[PFObject(Private) _deepSaveAsync:withCurrentUser:sessionToken:]_block_invoke311 in Parse(PFObject.o)

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I get the exact same error if I use the Bolts.framework included in the FacebookSDK package.

But, using the Bolts.framework included in the Parse Library I got a different error:

ld: 91 duplicate symbols for architecture x86_64

All frameworks and libraries are updated.

EDIT:

Using cocoapods solved the problem for me too!

SFWdc
  • 86
  • 4
0

See: FacebookSDK and Bolts conflicting each other (duplicate symbols) on build.

I would suspect that Facebook is broken, and is including bolts itself. No thirdparty framework should include another thirdparty framework, since it leads to exactly this. All third-party frameworks should be linked at the final application stage. Go into any frameworks that link their own sub-libraries, and remove the sub-sublibraries (and open bugs against the offenders).

Community
  • 1
  • 1
Rob Napier
  • 286,113
  • 34
  • 456
  • 610
  • thanks for your reply, but I got the parse and facebook frameworks to work together. It's firebase that needs the flag and the other two don't want it – Alessandro Mar 16 '15 at 19:31
  • The fact that they can't compile with it suggests that they're linking incorrectly (I assume you're seeing "duplicate symbol" errors?) You should make sure that the neither of them is directly linking bolt, and that you link that at the end. The `-ObjC` flag impacts final link, so it's going to be difficult to only apply it to certain libraries. It's whole point is to force things to be included even if they aren't apparently used. – Rob Napier Mar 16 '15 at 19:35
  • Yes if I remove the flag I get duplicate symbol errors, but I don't know how to get rid of them other tan removing the flag – Alessandro Mar 16 '15 at 19:43
  • By removing the duplicate framework (bolt) that each of them is linking. You need to remove bolt from all the sub-frameworks, and then link it at the top. I would also take it up with the SDK providers. It sounds like their packages are broken if they're shipping bolt to you. – Rob Napier Mar 16 '15 at 19:53
  • In my Xcode project I have one Parse.framework, one Facebook.framework and only one Bolts.framework. There is only one copy of the framework. The only thing I have left is to delete this only copy, which would give me no Bolts... Am I doing something wrong? – Alessandro Mar 16 '15 at 23:02
  • Check that neither Facebook not Parse includes their own copy. Check the errors carefully. They sometimes tell you the paths to the conflicting symbols. – Rob Napier Mar 17 '15 at 00:12