重复符号、GTMOAuth2 和 Facebook SDK for IOS 均使用 SBJSON
我有一个应用程序,其中我实现了 Facebook 登录。我将 facebook sdk 的源代码直接复制到我的项目中。现在我需要添加谷歌登录。这次我添加了 GTMOAuth2 作为静态库。 (我也有这个源,但我添加为静态库没有具体原因)。问题是他们都使用 SBJson 并且我得到了重复的符号。看来 facebook sdk 中的 SBJson 比 GTMOAuth2 库中的 SBJson 更新。我是菜鸟,以前从未有过重复的符号,我该怎么办?是否有针对此特定问题或解决一般重复符号的解决方案?我是否只删除出现两次的内容直到它起作用,是否有一些链接器设置?谢谢。
更新 - 我尝试过的:
将两个项目添加为静态库。
我尝试从 GTMOAuth2 中删除 SBJSON.h/m 文件,结果:google 登录后出现 json 解析错误:
我尝试从 Facebook iOS SDK 中删除 SBJSON.h/m 文件;结果:facebook 登录后 json 解析错误。
我可以让这两个版本的 SBJSON 在我的应用程序中神奇地共存,而不会出现重复的符号吗?我是否必须修改一个库才能与我决定使用的 ONE SBJSON 配合使用?
I have an app in which I have implemented facebook login. I copied the sources from the facebook sdk directly into my project. Now I need to add google login. This time I have added GTMOAuth2 as a static library. (I also have the source for this too but I added as a static library for no specific reason). The problem is they are both using SBJson and I get duplicate symbols. It appears that the SBJson in the facebook sdk is newer than the one in the GTMOAuth2 library. I'm a noob I never had duplicate symbols before, what should I do? Are there solutions to this specific problem or to resolving duplicate symbols in general? Do I just delete stuff that appears twice until it works, are there some linker settings? Thanks.
Update - What I tried:
Added both projects as a static library.
I tried deleting the SBJSON.h/m files from GTMOAuth2, result: json parse error after google login:
I tried deleting the SBJSON.h/m files from the Facebook iOS SDK; result: json parse error after facebook login.
Can I make these two versions of SBJSON magically coexist in my app without duplicate symbols? Do I have to modify one library to work with the ONE SBJSON I decite to use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我正在使用 facebook sdk 中的 SBJSON。我刚刚从 GTMOAuth2 库中删除了 SBJSON,以避免重复符号,正如 Ishu 建议的那样。
下一个问题是 GTMOAuth2 首先尝试使用 SBJSONParser 并且该类没有 objectWithString:error: 方法,只有 SBJSON 有该方法。我修改了代码以使用 SBJSON 类,甚至不尝试使用 SBJSONParser,因为它不起作用。在原始版本中,首先检查 SBJsonParser,然后检查 SBJSON。
更新
此处我在 GTM-OAuth2 讨论组中提出了同样的问题。这是我回答问题后发生的,但我忘了在这里更新我的答案。总而言之,这就是我所做的:
这将为您留下 Facebook SDK 中包含的最新 SBJSON 库。 Facebook SDK 和 GTM-OAuth2 都将使用该 SDK。它应该有效。
I'm using SBJSON from the facebook sdk. I just removed SBJSON from the GTMOAuth2 library to avoid duplicate symbol as suggested by
Ishu
.The next problem is that GTMOAuth2 tries to use SBJSONParser first and that class doesn't have objectWithString:error: method, only SBJSON has the method. I modified the code to use SBJSON class, and don't even try to use SBJSONParser because it doesn't work. In the original version
SBJsonParser
was checked first and then SBJSON.UPDATE
Here I asked the same question in the GTM-OAuth2 discussion group. This happened after I answered the question, but I forgot to update my answer here. In summary this is what I did:
This leaves you with the most up to date SBJSON library included in the Facebook SDK. Both Facebook SDK and GTM-OAuth2 will use that one. It should work.
yes 删除 GTMOAuth2 库的 SBJSON(因为它是旧版本)。
yes delete the SBJSON of GTMOAuth2 library (since it is older version).