在已有项目中使用pod导入高德地图,报了如下错误:html
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 architectureruby
鄙人遇到的问题并不在其列,下面是本人的解决方法:给"Other Linker Flags"添加"$(inherited)"iphone
这还要归功于pod,接下来分享一下我的解决问题的过程:ide
首先我导入高德地图的方式是pod自动导入,这种方式很方便.在DOS窗口下键入"pod install"后便可导入任何想要的已有第三方库,(具体使用与安装参考:如何安装/更新ruby,安装cocoapods,为开发作好准备!)ui
而后,我发现此次的导入并无打印出往常的成功信息,而是出现了如下内容:spa
[!] 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.
意思是:.net
[!]`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_LDFLAGSdebug
在Build setting中搜索到了,也就是上面图中所示.code
具体什么缘由呢?按照之前的作法,pod通常会成功,若是不成功,即是项目中有些设置与pod冲突了,这里即是Other Link Flags冲突了.htm