关于ios 程序加载百度地图lib,出现链接错误:找不到符号 (null): _OBJC_CLASS_$_BMKMapManager的解决办法

时间:2022-08-26 21:11:34

报告的错误信息

ld: warning: ignoring file /Users/5012/Documents/sphuang/IOS_project/baidu_map/ShareLocation/libs/Release-iphonesimulator/libbaidumapapi.a, file was built for archive which is not the architecture being linked (x86_64): /Users/5012/Documents/sphuang/IOS_project/baidu_map/ShareLocation/libs/Release-iphonesimulator/libbaidumapapi.a
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_BMKMapManager", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

尝试了文档中的三种加载库的方法,都失败了。编译从网上下载的百度地图示例,没有出现链接错误。

通过对比两个工程的编译属于,发现出错的工程有一个配置与示例工程不一致。
Build Settings -> Architectures -> Valid Architectures  :  armv7 armv7s  arm64

而正确的工程属性里没有arm64的配置。去掉后,编译通过