2015-06-04 42 views
1

我正在嘗試在iOS Swift項目中使用Google Endpoints。重複的符號Apple Mach-O鏈接程序錯誤

我創建Python中的Hello World端點的項目,我,我按照這些說明來設置它在我的項目設置它AppEngine上每https://cloud.google.com/appengine/docs/python/endpoints/

https://cloud.google.com/appengine/docs/python/endpoints/consume_ios#Python_Adding_required_files_to_your_iOS_project 我使用了Google+ API了。

我被卡在上面的第3步。爲了方便起見,我在這裏重新鍵入:

Your project needs to include the foo.h & foo_Sources.m files generated from ServiceGenerator, which you ran previously, where foo is your API name. Disabling ARC is not required for these files.

在Xcode中,我去添加文件和我添加的.h和.m文件。我也修改我的Bridging Header文件,並編輯我的Build Settings Header搜索路徑以包含正確的路徑。

當我嘗試建立,我得到這個錯誤:

Ld /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE normal armv7 
    cd /Users/rommelrico/Documents/GitHub/github.sandiego.edu/Mobile/WISEMobile 
    export IPHONEOS_DEPLOYMENT_TARGET=8.1 
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" 
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk -L/Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Products/Debug-iphoneos -F/Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Products/Debug-iphoneos -F/Users/rommelrico/Documents/GitHub/github.sandiego.edu/Mobile/WISEMobile -filelist /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -ObjC -v -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE.swiftmodule -miphoneos-version-min=8.1 -framework QuartzCore -framework UIKit -framework SystemConfiguration -framework Security -framework MediaPlayer -framework CoreText -framework GooglePlus -framework CoreGraphics -framework CoreMotion -framework CoreLocation -framework Foundation -framework AssetsLibrary -framework GoogleOpenSource -framework AddressBook -Xlinker -dependency_info -Xlinker /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE_dependency_info.dat -o /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE 

Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn) 
Target: arm-apple-darwin14.3.0 
Thread model: posix 
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch armv7 -dead_strip -iphoneos_version_min 8.1.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk -ObjC -o /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE -L/Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Products/Debug-iphoneos -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -filelist /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE.LinkFileList -rpath @executable_path/Frameworks -add_ast_path /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE.swiftmodule -framework QuartzCore -framework UIKit -framework SystemConfiguration -framework Security -framework MediaPlayer -framework CoreText -framework GooglePlus -framework CoreGraphics -framework CoreMotion -framework CoreLocation -framework Foundation -framework AssetsLibrary -framework GoogleOpenSource -framework AddressBook -dependency_info /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE_dependency_info.dat -framework Foundation -lobjc -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/lib/darwin/libclang_rt.ios.a -F/Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Products/Debug-iphoneos -F/Users/rommelrico/Documents/GitHub/github.sandiego.edu/Mobile/WISEMobile 
duplicate symbol _OBJC_METACLASS_$_GTLHelloworldHelloGreeting in: 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworldHelloGreeting.o 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o 
duplicate symbol _OBJC_CLASS_$_GTLHelloworldHelloGreeting in: 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworldHelloGreeting.o 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o 
duplicate symbol _OBJC_CLASS_$_GTLServiceHelloworld in: 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLServiceHelloworld.o 
duplicate symbol _OBJC_METACLASS_$_GTLServiceHelloworld in: 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLServiceHelloworld.o 
duplicate symbol _OBJC_METACLASS_$_GTLQueryHelloworld in: 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLQueryHelloworld.o 
duplicate symbol _OBJC_CLASS_$_GTLQueryHelloworld in: 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLQueryHelloworld.o 
duplicate symbol _OBJC_METACLASS_$_GTLHelloworldHelloGreetingCollection in: 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworldHelloGreetingCollection.o 
duplicate symbol _OBJC_CLASS_$_GTLHelloworldHelloGreetingCollection in: 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o 
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworldHelloGreetingCollection.o 
ld: 9 duplicate symbols for architecture armv7 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

我的觀察

它看起來像在.m文件的import語句引起的問題。我正在關注Google的文檔以獲取他們SDK的信件,所以我想知道這是否是Swift/Objective-C限制。我沒有看到有人能夠將它設置在Github上,雖然:https://github.com/soundTricker/swift-cloud-endpoint-sample

這裏是我的問題

  1. 爲什麼會說「爲架構的ARMv7 9重複的符號」?我正在計算正好8個「重複符號」錯誤消息...
  2. 我在哪裏添加「-v」來查看調用?
  3. 這些.o文件是什麼?什麼是我需要修復的9個重複符號?
  4. 我在想辦法解決這個問題,就是用我的Google Endpoints API文件創建一個框架。這樣,我只能在我的項目中包含.h文件。這是一個壞主意嗎?

僅供參考:我使用Google的代碼完全從他們的Github存儲庫克隆出來,以排除我的代碼存在的任何問題。即使在一個乾淨的項目中,我也會遇到同樣的問題我正在使用Xcode v.6.3.1。

-Rommel。

回答

2

我想通了我的問題。 Google API ServiceGenerator會生成一系列文件實現和頭文件,Google文檔會將其添加到您的項目中。不幸的是,它還會生成一個帶有衝突的導入語句的_Sources.m文件。我從iOS項目中刪除了該文件,併成功構建了該項目。