在已有項目中使用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