做SDK或者引用SDK时候经常报 Undefined symbols for architecture arm64 ... clang: error: linker command failed with exit code 1 (use -v to see invocation)
的错误
例如:
Undefined symbols for architecture arm64: "_CTRadioAccessTechnologyEdge", referenced from: -[IFlyReachability networkStatusForFlags:] in iflyMSC(IFlyReachability.o) "_CTRadioAccessTechnologyGPRS", referenced from: -[IFlyReachability networkStatusForFlags:] in iflyMSC(IFlyReachability.o) "_CTRadioAccessTechnologyLTE", referenced from: -[IFlyReachability networkStatusForFlags:] in iflyMSC(IFlyReachability.o) "_OBJC_CLASS_$_CTTelephonyNetworkInfo", referenced from: objc-class-ref in iflyMSC(IFlySystemInfo.o) objc-class-ref in iflyMSC(IFlyReachability.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
如果是开发SDK过程中遇到这个问题,查看下SDK是否支持arm64,检查 Build Active Architectures Only。 一般的在Debug 模式为YES,Release模式为NO。
如果是引入别人的SDK时报的错误,
- 可能是framework或者.a路径不对,删除SDK重新导入。
- 查看是否缺少了依赖库。
绝大多数情况都是缺少文件导致的这样的错误,少引库了或者少添加文件了,或者库里少添加了文件等。