2016-08-15 383 views
3

我遵循Facebook開發人員指南中列出的所有準則,針對iOS反應本機sdk,但我仍然無法構建應用程序。附上我的配置的屏幕截圖,並生成日誌React native facebook iOS sdk編譯失敗

enter image description here

Ld /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/Alnomad.app/Alnomad normal x86_64 cd /Applications/MAMP/htdocs/marscodes/alnomad-ios/ios export IPHONEOS_DEPLOYMENT_TARGET=8.0 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/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/iPhoneSimulator9.3.sdk -L/Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator -F/Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator -F/Applications/MAMP/htdocs/marscodes/alnomad-ios/ios/../node_modules/react-native-facebook-login/FacebookSDK -F/Applications/MAMP/htdocs/marscodes/alnomad-ios/ios -F. -FAlnomad -FAlnomadTests -Fbuild -FFacebookSDK -Fbuild/Build -Fbuild/Logs -FFacebookSDK/AccountKitStrings.bundle -FFacebookSDK/DocSets -FFacebookSDK/FacebookSDKStrings.bundle -FFacebookSDK/Samples -Fbuild/Logs/Build -FFacebookSDK/AccountKitStrings.bundle/Resources -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset -FFacebookSDK/FacebookSDKStrings.bundle/Resources -FFacebookSDK/Samples/Configurations -FFacebookSDK/Samples/FBAudienceNetwork -FFacebookSDK/Samples/Iconicus -FFacebookSDK/Samples/RPSSample -FFacebookSDK/Samples/Scrumptious -FFacebookSDK/Samples/ShareIt -FFacebookSDK/Samples/SwitchUserSample -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents -FFacebookSDK/Samples/FBAudienceNetwork/AdUnitsSample -FFacebookSDK/Samples/FBAudienceNetwork/NativeAdSample -FFacebookSDK/Samples/Iconicus/Configurations -FFacebookSDK/Samples/Iconicus/Iconicus -FFacebookSDK/Samples/RPSSample/RPSSample -FFacebookSDK/Samples/Scrumptious/scrumptious -FFacebookSDK/Samples/ShareIt/ShareIt -FFacebookSDK/Samples/SwitchUserSample/SwitchUserSample -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents/Resources -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents/Resources -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents/Resources -FFacebookSDK/Samples/FBAudienceNetwork/AdUnitsSample/AdUnitsSample -FFacebookSDK/Samples/FBAudienceNetwork/NativeAdSample/NativeAdSample -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents/Resources/Documents -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents/Resources/Documents -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents/Resources/Documents -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents/Resources/Documents/Classes -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents/Resources/Documents/Constants -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents/Resources/Documents/css -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents/Resources/Documents/img -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents/Resources/Documents/Protocols -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents/Resources/Documents/Classes -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents/Resources/Documents/Constants -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents/Resources/Documents/css -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents/Resources/Documents/img -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents/Resources/Documents/Protocols -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents/Resources/Documents/Classes -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents/Resources/Documents/Constants -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents/Resources/Documents/css -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents/Resources/Documents/img -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents/Resources/Documents/Protocols -F/Applications/MAMP/htdocs/marscodes/alnomad-ios/ios/FacebookSDK -filelist /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Intermediates/Alnomad.build/Debug-iphonesimulator/Alnomad.build/Objects-normal/x86_64/Alnomad.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=8.0 -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lc++ -fobjc-arc -fobjc-link-runtime /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libReact.a /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTActionSheet.a -framework FBSDKLoginKit /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTGeolocation.a /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTImage.a /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTLinking.a /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTNetwork.a /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTSettings.a -framework FBSDKShareKit /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTText.a /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTVibration.a /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTWebSocket.a -lRNVectorIcons -framework FBSDKCoreKit -lRNI18n -lRCTFBSDK -Xlinker -dependency_info -Xlinker /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Intermediates/Alnomad.build/Debug-iphonesimulator/Alnomad.build/Objects-normal/x86_64/Alnomad_dependency_info.dat -o /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/Alnomad.app/Alnomad

ld: warning: Auto-Linking supplied 'FacebookSDK/Bolts.framework/Bolts', framework linker option at FacebookSDK/Bolts.framework/Bolts is not a dylib Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_FBSDKHashtag", referenced from: objc-class-ref in libRCTFBSDK.a(RCTConvert+FBSDKSharingContent.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

回答

1

請務必下載並保存在您的計算機(https://developers.facebook.com/docs/ios/)上FacebookSDK文件夾。我通常將它放在〜/ Documents/FacebookSDK中,並從構建設置中引用它。除了將3個框架文件拖到Frameworks文件夾中。

+0

因爲它在屏幕截圖中,我確實拖動了3個.framework文件,並將sdk文件夾放在正確的路徑 –

4

我最近在我的反應原生項目上做了同樣的事情,我花了相當多的時間使它工作。

您的情況似乎是,您的項目文件夾中沒有包括Bolts.frameworkFBSDKCoreKit.framework的依賴項。我相信這就是爲什麼Facebook官方文檔建議每個人都要保留SDK文件在~/Documents,所以你不要錯過依賴項文件,或者不得不在你的每個項目上覆制這些文件。

以下是對誰是有與整合問題的人一些故障排除步驟:

1.鏈接react-native-fbsdk到您的項目。 (編輯:正如最近的,連接不使用SDK工作按照以下@ chez.mosey的答案,您可以按照此步驟blog的SDK手動添加到您的項目。)

rnpm link react-native-fbsdk

react-native link react-native-fbsdk 

編輯:rnpm自2016年8月1日起已被集成到React Native中。從此,請使用react-native link來鏈接您的依賴關係。

link函數通過鏈接所有本機依賴項來更新您的項目,在這種情況下,我們將react-native-fbsdk鏈接到本機FacebookSDK。

2.將libRCTFBSDK.a添加到構建階段 - >鏈接二進制與Xcode中的庫。

運行react-native link時應自動添加,但請確保它在那裏。

3.導入FacebookSDK框架手動

文件從經驗來說,如果你使用的CocoaPods下載FBSDK框架文件時,Xcode不會libRCTFBSDK.a一起建造它們。按照官方FB文檔中的步驟,下載文件,將它們解壓縮到~/Documents/FacebookSDK,然後將它們拖到Xcode項目中而不復制它們。將路徑添加到框架搜索路徑。 (如果有人知道爲什麼的CocoaPods將無法正常工作的原因,我所有的耳朵)

4.清潔您的Xcode項目和刪除派生數據

做是爲了避免在先前構建文件搞亂與您當前的設置。

+0

感謝您的廣泛答覆,但它似乎仍然無法正常工作......所有內容都會建立起來,直到包含'libRCTFBSDK.a' ... –

+0

不太確定你在哪裏找到'libRCTFBSDK.a'。它不包含在從Facebook下載的Facebook SDK中 – jacks205

+0

@ jacks205一旦完成了與「react-native-fbsdk」的鏈接,庫文件將包含在您的Xcode項目中。 – tropicalfish

2

當您從(https://developers.facebook.com/docs/ios/)下載FacebookSDK時,該文件夾將被命名爲FacebookSDKs-iOS-4.20.1。 因此,請嘗試將其重命名爲FacebookSDK。

然後再次清理並構建您的Xcode項目。

0

正如其他人所建議的,請確保您遵守所有的SDK這裏的配置步驟:https://developers.facebook.com/docs/react-native/configure-ios/

這樣做後,我遇到的故障排除部分中提到的問題,「如果你得到一個編譯錯誤如'警告:'RCTFBLikeView'的本地組件不存在,'驗證libRCTFBSDK.a顯示在您的構建目標的構建階段的鏈接二進制庫部分。「我相信這是你遇到的問題。

問題是,我不知道如何解決libRCTFBSDK.a沒有顯示的事實。原來,這是因爲react-native-fbsdk沒有正確鏈接,因此我不得不手動鏈接它,我可以按照以下提供的精彩步驟進行操作:http://www.namvo.me/manual-setup-for-facebook-sdk-in-react-native/

相關問題