Duplicate symbols when using GTM OAuth2 together with Facebook SDK for iphone

435 views
Skip to first unread message

gyozo

unread,
Jul 12, 2011, 3:26:58 AM7/12/11
to GTM OAuth 2 Discussion
Hello, the problem is both projects, the GTM OAuth2 library and
Facebook SDK, have a SBJSON class in them and they are different. If I
delete the one from the oauth library then google login gives an
exception (something related to sbjson) if I delete the one from the
facebook sdk then facebook login is not working for the same reason.
If I try to use both I get duplicate symbol errors. Both projects are
included as a static library. Is there an easy solution to this?
Thanks.

Greg Robbins

unread,
Jul 12, 2011, 3:50:03 AM7/12/11
to gtm-o...@googlegroups.com
GTM OAuth2 should work with either the old or the new version of SBJSON in your application. 

If one of those is linked in for the Facebook SDK, just do not include another copy for GTM OAuth2.

Set a breakpoint at -[GTMOAuth2Authentication dictionaryWithJSONData:] to see the loading of the JSON parsing class.

gyozo kudor

unread,
Jul 12, 2011, 7:13:28 AM7/12/11
to gtm-o...@googlegroups.com
Right now I'm using SBJSON from the Facebook SDK. It gives me the following exception:

'NSInvalidArgumentException', reason: '-[SBJsonParser objectWithString:error:]: unrecognized selector sent to instance 0x448d9b0'

this is in GTMOAuth2Authentication.m in the method
  - (NSDictionary *)dictionaryWithJSONData:(NSData *)data
at line 328:
  obj = [parser objectWithString:jsonStr error:&error];

I don't know what's wrong.

Greg Robbins

unread,
Jul 12, 2011, 3:08:50 PM7/12/11
to gtm-o...@googlegroups.com
SBJsonParser's implementation should have the objectWithString:error: method.

gyozo kudor

unread,
Jul 13, 2011, 2:04:17 AM7/13/11
to gtm-o...@googlegroups.com
SBJSON HAS the method, SBJSONParser has ONLY objectWithString without error. I modified the code to use SBJSON and it works. Thanks for the help.

Greg Robbins

unread,
Jul 13, 2011, 2:58:19 AM7/13/11
to gtm-o...@googlegroups.com
It sounds like that's an old version of SBJSONParser.

gyozo kudor

unread,
Jul 13, 2011, 3:01:23 AM7/13/11
to gtm-o...@googlegroups.com
I don't know how old it is I downloaded it with facebook sdk a week ago I think.

gyozo kudor

unread,
Jul 13, 2011, 6:58:26 AM7/13/11
to gtm-o...@googlegroups.com
I tried adding the latest sbjson as a static library to the project and use that but I either got missing symbols or duplicate symbols. I don't have much experience with using and linking libraries. I don't know how to set up the linker correctly. I never used a static library in my project that itself was used in another static library. (I tried linking libsbjson with my main project, with the Facebook SDK and with GTMOAuth2, tried several combinations nothing worked ) If I don't find out what is wrong I guess I will use the older version from the facebook SDK. If somebody has some advice please tell me. Thanks.

gyozo kudor

unread,
Jul 13, 2011, 8:39:12 AM7/13/11
to gtm-o...@googlegroups.com
I have replaced the old SBJSON from the facebook sdk with the latest one from github. I had to modify the facebook sdk in one place to make it work, but at least both are working now with a new version of the json parser. I will probably leave this way.

obsesif

unread,
Sep 5, 2011, 7:45:30 AM9/5/11
to GTM OAuth 2 Discussion

would you be kind to share these implementations as i also would like
to use google libs to auth with facebook.
a step by step to use fb services trough google auth would evenbe
better...
thanks..


On Jul 13, 3:39 pm, gyozo kudor <kudorgy...@gmail.com> wrote:
> I have replaced the old SBJSON from the facebook sdk with the latest one
> from github. I had to modify the facebook sdk in one place to make it work,
> but at least both are working now with a new version of the json parser. I
> will probably leave this way.
>
>
>
> On Wed, Jul 13, 2011 at 1:58 PM, gyozo kudor <kudorgy...@gmail.com> wrote:
> > I tried adding the latest sbjson as a static library to the project and use
> > that but I either got missing symbols or duplicate symbols. I don't have
> > much experience with using and linking libraries. I don't know how to set up
> > the linker correctly. I never used a static library in my project that
> > itself was used in another static library. (I tried linking libsbjson with
> > my main project, with the Facebook SDK and with GTMOAuth2, tried several
> > combinations nothing worked ) If I don't find out what is wrong I guess I
> > will use the older version from the facebook SDK. If somebody has some
> > advice please tell me. Thanks.
>
> > On Wed, Jul 13, 2011 at 9:58 AM, Greg Robbins <grobb...@google.com> wrote:
>
> >> It sounds like that's an old version of SBJSONParser.
>
> >>https://github.com/stig/json-framework/blob/master/Classes/SBJsonPars...

gyozo kudor

unread,
Sep 5, 2011, 2:08:20 PM9/5/11
to gtm-o...@googlegroups.com
Hello, I'm on holiday right now and my project is at my workplace so I cannot give you exact instructions until next week, I don't even have a mac at home. I already described how I did it, it wasn't anything special but here it is again:
  • download sbjson from github : https://github.com/stig/json-framework/blob/master/Classes/SBJsonParser.h
  • copy these files to the facebook sdk, overwrite everything, the sbjson used by facebook sdk is older
  • Fix the compile errors in the facebook sdk and build it. I don't remeber exactly what these were but some of the methods in the new version of sbjson looked different, I remember it was an easy 5 minute task
  • I think this shouldn't matter, but I used the Facebook SDK and GTM-OAuth2 as static libraries, I didn't just copy the sources over into my main project, there are some tutorials on how to do this like this one http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/ if you want to give it a try
  • Both Facebook and google login should work correctly now

gyozo kudor

unread,
Sep 6, 2011, 7:16:56 AM9/6/11
to gtm-o...@googlegroups.com
would you be kind to share these implementations as i also would like
to use google libs to auth with facebook.

I don't think you can use gtm-oauth2 to login to facebook, you'll have to use both, facebook sdk for facebook login and gtm-oauth2 for google login.
Reply all
Reply to author
Forward
0 new messages