Duplicate Symbol SBJSON on iOS Facebook SDK V 3.0

2020-07-23 06:53发布

问题:

In the current project, I used SBJSON everywhere and got it working fine with the previous version of iOS Facebook SDK since SBJSON was included in Facebook SDK.

I just upgraded to iOS Facebook SDK version 3.0 and having problem with SBJSON.

The first thing it complaint was about NOT finding SBJSON header file. So I thought, I could manually include the SBJSON lib into the project.

After I did that, then the compiler complaint that the SBJSON symbol was duplicated with the Facebook SDK.

I could not find the SBJSON.h anywhere in FB SDK headers.

So at the end, I went into a loop of problems.

Does anyone know how to solve this issue? The worst case could be that I have to switch to use other JSON library for iOS.

Note: They are using framework for Facebook SDK, not the source code library like before

Cheers

回答1:

What I ended up using to solve this are two approaches:

The first one

  • Firstly, not using the pre-built Facebook SDK framework that they provided
  • Secondly, check out the Facebook SDK source code from Facebook SDK and integrate it to the project

The second one

Integrate the Json-framework using their source code here and change the name of any duplicate class to something unique to your project like SBJsonParser to MySBJsonParser