IOS开发~解决引入第三方framework出现duplicate symbol错误

来源:互联网 发布:网络与系统安全 编辑:程序博客网 时间:2024/05/17 09:01
当工程中引入其他第三方framework,或者自己制作framework(不是 .a),会遇到duplicate symbol问题。

If you updated to the recently released iOS SDK 4, you may have encountered a rather annoying issue. All projects that link again a static library which is the combination of multiple sub-libraries now fail to link, producing only a "duplicate symbols" error.

看了好多解决办法:
http://kemenaran.winosx.com/?2010/06/30/174-fix-duplicate-symbols-when-linking-a-universal-static-library-with-ios-sdk-4
http://atastypixel.com/blog/avoiding-duplicate-symbol-issues-when-using-common-utilities-within-a-static-library/
http://stackoverflow.com/questions/12277786/preventing-duplicate-symbol-errors-with-ios-frameworks
http://www.zhihu.com/question/20728615
http://zl4393753.iteye.com/blog/1378471

不过都没有解决问题。

碰巧发现这个方法,想想也不难理解,问题最后解决了。
在出现duplicate symbol的项目中,选择出现问题的framework,调出IB控制面板,取消相应framework的Target Membership选项的勾选,问题就解决了。