use_frameworks引起的Undefined symbols for architecture arm64

网友投稿 883 2022-10-17

use_frameworks引起的Undefined symbols for architecture arm64

use_frameworks引起的Undefined symbols for architecture arm64

OC工程可以使用也可以不使用use_frameworks!,而含有swift的工程必须使用use_frameworks!。 若原来用oc创建的私有库含有extern导入的全局变量或常量会造成该错误。

Undefined symbols for architecture arm64: "_sCommonUnitBoldFontHeight", referenced from: -[BITUCNNaviView exitBtn] in BITUCNNaviView.o -[BITUCNNaviView confirmBtn] in BITUCNNaviView.o -[BITUCNNaviView adjustAutoLayout] in BITUCNNaviView.o "_sCommonUnitEdgeDistance", referenced from: -[BITUCNNaviView adjustAutoLayout] in BITUCNNaviView.o "_sCommonUnitFontHeight", referenced from: -[BITCMSelectTableViewCell loadData:hideLine:] in BITCMSelectTableViewCell.old: symbol(s) not found for architecture arm64clang: error: linker command failed with exit code 1 (use -v to see invocation)

出问题的代码:

//常用字体高度extern const NSInteger sCommonUnitFontHeight;

//常用字体高度const NSInteger sCommonUnitFontHeight = 13;

最笨的解决方案,直接把私有库拖入工程,然后修改头文件的包含方式。

正确的库是:

探索通过建立一个公用的私有库,它依赖其它私有库,结果问题仍旧存在。

正探索其它通用导入方式的可行性。利用test导入工程,然后手动增加私有库。

target 'DYLiangXinApp' do # Comment the next line if # Pods for use_frameworks! # 数据 pod 'AFNetworking' pod 'MJExtension'endtarget 'DYLiangXinAppTests' do # Comment the next line if # Pods for pod 'DYVideoPlayer'

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Netty启动流程注册多路复用源码分析
下一篇:JFaster- JFaster快速发框架
相关文章

 发表评论

暂时没有评论,来抢沙发吧~