解决Three20与其他framework冲突的办法

原文链接地址:http://blog.csdn.net/sing_sing/article/details/7553523 

项目中用到Three20框架,同时也使用了讯飞语音的framework,编译时出现类似如下冲突提示信息:

ld: duplicate symbol _OBJC_CLASS_$_AdLinks in /Users/w/Documents/project 2/dianxing_v2.00_code_reconfiguration/iFlyLib/iFlyTTS.framework/iFlyTTS(AdvertiseDataDefine.o) and /Users/w/Documents/project 2/dianxing_v2.00_code_reconfiguration/iFlyLib/iFlyISR.framework/iFlyISR(AdvertiseDataDefine.o) for architecture i386
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1

网上收集了一下对于该问题的解答,感觉还比较靠谱,粘贴如下:

个人猜想,大概是在iFlyTTS和iFlyISR在编译的时候,都加入了AdvertiseDataDefine.m(AdvertiseDataDefine.o)这个文件,而里面包含了AdLinks这个类的category。在一般的链接参数下倒是没有问题(因为category的链接被忽略了),但是如果引入了Three20,于是就加入了-ObjC - all_load这个参数(没办法,这个参数对于Three20的运行时必须的),于是这个链接错误就表现出来了(于是链接时就出现了duplicate symbol _OBJC_CLASS_$_AdLinks in iFlyTTS(AdvertiseDataDefine.o) and iFlyISR(AdvertiseDataDefine.o) for architecture XXXX)。


解决方案:修改链接参数(Other Linker Flag)
1.去掉-ObjC -all_load参数(这个参数会强制所有的静态链接库都加载其中的category);
2.改为逐一加载Three20的各个静态库,即修改链接参数(Other Linker Flag)为如下形式:


-force_load $(BUILT_PRODUCTS_DIR)/libThree20.a 
-force_load $(BUILT_PRODUCTS_DIR)/libThree20UINavigator.a 
-force_load $(BUILT_PRODUCTS_DIR)/libThree20UICommon.a 
-force_load $(BUILT_PRODUCTS_DIR)/libThree20UI.a 
-force_load $(BUILT_PRODUCTS_DIR)/libThree20Style.a 
-force_load $(BUILT_PRODUCTS_DIR)/libThree20Network.a 
-force_load $(BUILT_PRODUCTS_DIR)/libThree20Core.a


ps:写这篇文章主要目的是为了说明,在碰到Three20和其他framework冲突的时候,可以考虑一下逐个加载Three20的lib,而不是使用-ObjC - all_load参数一次性强制加入。


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值