iOS 高德地图报错问题解决

iOS版高德地图SDK将 AMapFoundationKit.framework 和 AMapLocationKit.framework放进项目中,编译直接报错:

Undefined symbols for architecture arm64:

"_OBJC_CLASS_$_CTTelephonyNetworkInfo", referenced from:

      objc-class-ref in AMapFoundationKit(AMapFoundationKit-arm64-master.o)

  "_OBJC_CLASS_$EAAccessoryManager", referenced from:

      objc-class-ref in AMapLocationKit(AMapLocationKit-arm64-master.o)

d: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

image

解决方案:去TARGETS-Build Phases中的Link Binary With Libraries,点击+重新引入一遍需要的系统库CoreTelephony.framework,libc++.tbd,libz.tbd,ExternalAccessory.framework 编译通过.

当然我看到网络上很多类似的,但是跟我情况又不是一样的,比如下面的可以参考:
iOS 高德地图定位sdk报错Undefined symbols for architecture armv7: "OBJC_CLASS$_JSValue", referenced from: -->sw_gegewu

使用高德定位的SDK后集成编译报错--> shimeifang11

综合自己情况和他人情况我得出:

1.下载高德地图定位SDK的demo
2.参考自己项目中报错 "OBJC_CLASS$XXXXX",去demo的 TARGETS-Build Phases中的Link Binary With Libraries 查看,XXXX和那个链接库一致或类似,自己项目中引入.
3.或者直接将demo中的10个链接库全部添加到自己项目中即可.
编译通过.

链接:https://www.jianshu.com/p/3bed141f64da