首页 > 代码库 > iOS导入高德地图出现缺失armv7--"Undefined symbols for architecture armv7"

iOS导入高德地图出现缺失armv7--"Undefined symbols for architecture armv7"

在已有项目中使用pod导入高德地图,报了以下错误:

ld: warning: directory not found for option -L/Users/paul/iOS/yun-hui-yi/libs/Release-iphoneos
Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_MAMapView", referenced from:
      objc-class-ref in SingleLocationViewController.o
  "_OBJC_CLASS_$_MAPointAnnotation", referenced from:
      objc-class-ref in SingleLocationViewController.o
  "_OBJC_CLASS_$_MAPinAnnotationView", referenced from:
      objc-class-ref in SingleLocationViewController.o
  "_OBJC_CLASS_$_AMapLocationManager", referenced from:
      objc-class-ref in SingleLocationViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

首先百度一下,会发现大家遇到这个问题的情况还很多,参考:错误总结:Undefined symbols for architecture

鄙人遇到的问题并不在其列,下面是本人的解决方法:

技术分享

 

这还要归功于pod,接下来分享一下个人解决问题的过程:

首先我导入高德地图的方式是pod自动导入,这种方式很方便.在DOS窗口下键入"pod install"后即可导入任何想要的已有第三方库,(具体使用与安装参考:如何安装/更新ruby,安装cocoapods,为开发做好准备!)

然后,我发现这次的导入并没有打印出往常的成功信息,而是出现了以下内容:

[!] The `CdmaMeeting [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-CdmaMeeting/Pods-CdmaMeeting.debug.xcconfig. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `CdmaMeeting [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-CdmaMeeting/Pods-CdmaMeeting.release.xcconfig. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

意思是:

[!]`CdmaMeeting [Debug]`目标覆盖Pods/Target Support Files/Pods-CdmaMeeting/Pods-CdmaMeeting.debug.xcconfig中定义的“OTHER_LDFLAGS”构建设置。 这可能会导致CocoaPods安装的问题
     - 使用`$(inherited)标志,或
     - 从目标中删除构建设置。

[!]“CdmaMeeting [Release]”目标覆盖“Pods/Target Support Files/Pods-CdmaMeeting/Pods-CdmaMeeting.release.xcconfig”中定义的“OTHER_LDFLAGS”构建设置。 这可能会导致CocoaPods安装的问题
     - 使用`$(inherited)标志,或
     - 从目标中删除构建设置。

于是,按照以前的习惯,在target中搜索:OTHER_LDFLAGS

在Build setting中搜索到了,也就是上面图中所示.

 

具体什么原因呢?按照以前的做法,pod一般会成功,如果不成功,便是项目中有些设置与pod冲突了,这里便是Other Link Flags冲突了.

 

iOS导入高德地图出现缺失armv7--"Undefined symbols for architecture armv7"