3

I am using RestKit, GData and Facebook API. All of them has a JSON files, many of them share the same name, enums etc. When i compile I get an error on duplicates.

How can i prevent the conflicts?

Thanks Shani

shannoga
  • 19,649
  • 20
  • 104
  • 169

2 Answers2

3

I ran into this issue because the new Facebook SDK 3.0 is now a static framework which also includes SBJSON, I also have another static framework which also includes the same class. Originally I would just go in and edit the source files of the Facebook SDK and apply a custom prefix to the SBJSON classes. This no longer works.

Here is an outside the box solution.

  1. Navigate to FacebookSDK.framework->Versions->Current
  2. Open the compiled FacebookSDK library file with the best IDE, textedit will do!
  3. Search case sensitive and replace all occurrences of "SBJson" with "FBJson"
  4. Search case sensitive and replace all occurrences of "SBJSON" with "FBJSON"
  5. Save, clean, compile.

Note: Some would say, why replace with FBJson and not FBSBJson? I determined it would be best to keep it the same character length to be safe. Note: If you are attempting this with other frameworks, be sure to search the header files for any references to the conflicting class that you are renaming. In this case the class being renamed was not referenced in any of the header files. If it had been, I would have made sure to rename it in the header files.

Josh Bernfeld
  • 4,246
  • 2
  • 32
  • 35
3

This is my best guess. It would be helpful to post the errors you get on compile.

If you are using the -all_load linker flag, turn it off. If your libraries require that you use this option, try using -force_load option on the specific libraries that require it. As an absolute last resort, build the libraries that you can from source, renaming colliding symbols.

The question below might provide some more insight on the all_load issues:

Objective-C categories in static library

Community
  • 1
  • 1
Jacob Jennings
  • 2,796
  • 1
  • 24
  • 26