2014-03-13 165 views
9

今天我更新了Xcode到Xcode 5.1,現在每當我嘗試編譯我的代碼並在模擬器上測試它時,我都遇到了有關架構86_64和Google Analytics服務庫的一些錯誤。 這是我的了:Xcode 5.1 ld:找不到-lGoogleAnalyticsServices的庫

Ld /Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Products/Debug-iphonesimulator/iSanMarino.app/iSanMarino normal x86_64 
    cd "/Users/prelite/Desktop/iSanMarino 3.0" 
    export IPHONEOS_DEPLOYMENT_TARGET=7.0 
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.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 x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Products/Debug-iphonesimulator -L/Users/prelite/Desktop/iSanMarino\ 3.0/iSanMarino/Analytics -F/Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Products/Debug-iphonesimulator -filelist /Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Intermediates/iSanMarino.build/Debug-iphonesimulator/iSanMarino.build/Objects-normal/x86_64/iSanMarino.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.0 -lGoogleAnalyticsServices -framework AudioToolbox -framework CoreData -framework QuartzCore -framework SystemConfiguration -lsqlite3 -framework EventKitUI -framework EventKit -framework CoreLocation -framework MessageUI -framework MapKit -framework UIKit -framework Foundation -framework CoreGraphics -Xlinker -dependency_info -Xlinker /Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Intermediates/iSanMarino.build/Debug-iphonesimulator/iSanMarino.build/Objects-normal/x86_64/iSanMarino_dependency_info.dat -o /Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Products/Debug-iphonesimulator/iSanMarino.app/iSanMarino 

Undefined symbols for architecture x86_64: 
    "_deflate", referenced from: 
     +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) 
    "_deflateEnd", referenced from: 
     +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) 
    "_deflateInit2_", referenced from: 
     +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) 
    "_inflate", referenced from: 
     +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) 
    "_inflateEnd", referenced from: 
     +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) 
    "_inflateInit2_", referenced from: 
     +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

我也更新了谷歌分析庫,並試圖刪除並重新進行添加,但一無所獲。

+0

我下載了一個新版本3.03c,做了一個清理和構建,一切都恢復正常。我猜你的舊圖書館(像我的)不支持這些架構。這裏的網址是https://developers.google.com/analytics/devguides/collection/ios/resources – DBD

+0

我已經試過了,我刪除了所有.m和.h以及框架文件...然後再次讀取了所有的文件3.03c執行了一個乾淨的但沒有改變......也許問題出在「Build Settings」中......你在「搜索路徑」和「有效架構」上設置了什麼? – prelite

+0

將目標更改爲ïOSDevice已解決的問題。對於模擬器不起作用。奇怪。 – Nirav

回答

42

解決方案:我只是添加了libz.dylib框架,一切正常!

+1

謝謝。爲我節省了很多時間。它真的很煩人,V3並不向後兼容。新方法需要更多編碼才能完成與之前版本相同的功能。請接受你自己的答案作爲正確答案。 – Ray

+0

很高興能幫到... :) – prelite

+0

感謝兄弟..我剛生氣! –

-1

如果您加載.xcodeproj文件並嘗試構建它,則會出現此錯誤。打開包含的.xcworkspace,你會沒事的。

要麼選擇「打開其他」,並從項目目錄中選擇,或從命令提示符在你的項目目錄:

open <YourProjectName>.xcworkspace 

應該不需要其他依賴。