带有Unity的Firebase导致XCode中的链接器错误

时间:2017-01-04 14:13:58

标签: ios xcode unity3d firebase linker-errors

我已使用FirebaseMessaging.unity包将Firebase添加到我的Unity项目中。

当我为Android构建和运行时,它可以工作,但是当我尝试为iOS构建时,我在XCode中遇到以下错误:

Ld /Users/one4freedk/Library/Developer/Xcode/DerivedData/Unity-iPhone-eijzxgpugrgbhsfkgmdnrbljevok/Build/Products/Debug-iphoneos/one4freeapp.app/one4freeapp normal armv7

    cd /Users/one4freedk/Desktop/One4Free/One4Free/iosbuild

    export IPHONEOS_DEPLOYMENT_TARGET=7.0

    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.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 armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk -L/Users/one4freedk/Library/Developer/Xcode/DerivedData/Unity-iPhone-eijzxgpugrgbhsfkgmdnrbljevok/Build/Products/Debug-iphoneos -L/Users/one4freedk/Desktop/One4Free/One4Free/iosbuild -L/Users/one4freedk/Desktop/One4Free/One4Free/iosbuild/Libraries -F/Users/one4freedk/Library/Developer/Xcode/DerivedData/Unity-iPhone-eijzxgpugrgbhsfkgmdnrbljevok/Build/Products/Debug-iphoneos -F/Users/one4freedk/Desktop/One4Free/One4Free/iosbuild/Frameworks/FacebookSDK/Plugins/iOS -F/Users/one4freedk/Desktop/One4Free/One4Free/iosbuild/Frameworks -filelist /Users/one4freedk/Library/Developer/Xcode/DerivedData/Unity-iPhone-eijzxgpugrgbhsfkgmdnrbljevok/Build/Intermediates/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/armv7/one4freeapp.LinkFileList -Xlinker -map -Xlinker /Users/one4freedk/Library/Developer/Xcode/DerivedData/Unity-iPhone-eijzxgpugrgbhsfkgmdnrbljevok/Build/Intermediates/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/one4freeapp-LinkMap-normal-armv7.txt -miphoneos-version-min=7.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/one4freedk/Library/Developer/Xcode/DerivedData/Unity-iPhone-eijzxgpugrgbhsfkgmdnrbljevok/Build/Intermediates/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/armv7/one4freeapp_lto.o -Xlinker -no_deduplicate -fembed-bitcode-marker -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -weak_framework CoreMotion -weak-lSystem -ObjC -lc++ -lsqlite3 -lz -licucore -lc++ -liPhone-lib -framework CoreText -framework AudioToolbox -weak_framework AVFoundation -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework CoreMedia -weak_framework CoreMotion -framework CoreVideo -framework Foundation -framework MediaPlayer -framework OpenAL -framework OpenGLES -framework QuartzCore -framework SystemConfiguration -framework UIKit -liconv.2 -framework Bolts -framework FBSDKShareKit -framework FBSDKCoreKit -framework FBSDKLoginKit -weak_framework Metal -framework FirebaseAnalytics -framework FirebaseCore -framework FirebaseInstanceID -framework FirebaseMessaging -framework GoogleInterchangeUtilities -framework GoogleSymbolUtilities -framework StoreKit -framework AddressBook -Xlinker -dependency_info -Xlinker /Users/one4freedk/Library/Developer/Xcode/DerivedData/Unity-iPhone-eijzxgpugrgbhsfkgmdnrbljevok/Build/Intermediates/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/armv7/one4freeapp_dependency_info.dat -o /Users/one4freedk/Library/Developer/Xcode/DerivedData/Unity-iPhone-eijzxgpugrgbhsfkgmdnrbljevok/Build/Products/Debug-iphoneos/one4freeapp.app/one4freeapp



Undefined symbols for architecture armv7:

  "_SWIGRegisterExceptionCallbacksArgument_FirebaseMessaging", referenced from:

      _SWIGExceptionHelper_SWIGRegisterExceptionCallbacksArgument_FirebaseMessaging_m2946342211 in Bulk_Firebase.Messaging_0.o

     (maybe you meant: _SWIGExceptionHelper_SWIGRegisterExceptionCallbacksArgument_FirebaseMessaging_m2946342211)

  "_SWIGRegisterStringCallback_FirebaseMessaging", referenced from:

      _SWIGStringHelper_SWIGRegisterStringCallback_FirebaseMessaging_m1829604336 in Bulk_Firebase.Messaging_0.o

     (maybe you meant: _SWIGStringHelper_SWIGRegisterStringCallback_FirebaseMessaging_m1829604336)

  "_Firebase_Messaging_SendPendingEvents", referenced from:

      _FirebaseMessagingPINVOKE_Firebase_Messaging_SendPendingEvents_m696476573 in Bulk_Firebase.Messaging_0.o

     (maybe you meant: _FirebaseMessagingPINVOKE_Firebase_Messaging_SendPendingEvents_m696476573)

  "_Firebase_Messaging_SetListenerCallbacksEnabled", referenced from:

      _FirebaseMessagingPINVOKE_Firebase_Messaging_SetListenerCallbacksEnabled_m633290538 in Bulk_Firebase.Messaging_0.o

     (maybe you meant: _FirebaseMessagingPINVOKE_Firebase_Messaging_SetListenerCallbacksEnabled_m633290538)

  "_Firebase_Messaging_SetListenerCallbacks", referenced from:

      _FirebaseMessagingPINVOKE_Firebase_Messaging_SetListenerCallbacks_m2687428259 in Bulk_Firebase.Messaging_0.o

     (maybe you meant: _FirebaseMessagingPINVOKE_Firebase_Messaging_SetListenerCallbacks_m2687428259, _FirebaseMessagingPINVOKE_Firebase_Messaging_SetListenerCallbacksEnabled_m633290538 )

  "_Firebase_Messaging_FirebaseMessage_From_get", referenced from:

      _FirebaseMessagingPINVOKE_Firebase_Messaging_FirebaseMessage_From_get_m3347431359 in Bulk_Firebase.Messaging_0.o

     (maybe you meant: _FirebaseMessagingPINVOKE_Firebase_Messaging_FirebaseMessage_From_get_m3347431359)

  "_Firebase_Messaging_delete_FirebaseMessage", referenced from:

      _FirebaseMessagingPINVOKE_Firebase_Messaging_delete_FirebaseMessage_m1658331736 in Bulk_Firebase.Messaging_0.o

     (maybe you meant: _FirebaseMessagingPINVOKE_Firebase_Messaging_delete_FirebaseMessage_m1658331736)

  "_SWIGRegisterExceptionCallbacks_FirebaseMessaging", referenced from:

      _SWIGExceptionHelper_SWIGRegisterExceptionCallbacks_FirebaseMessaging_m2350026019 in Bulk_Firebase.Messaging_0.o

     (maybe you meant: _SWIGExceptionHelper_SWIGRegisterExceptionCallbacks_FirebaseMessaging_m2350026019)

  "_Firebase_App_FirebaseApp_CreateInternal__SWIG_0", referenced from:

      _AppUtilPINVOKE_Firebase_App_FirebaseApp_CreateInternal__SWIG_0_m2787922779 in Bulk_Firebase.App_0.o

     (maybe you meant: _AppUtilPINVOKE_Firebase_App_FirebaseApp_CreateInternal__SWIG_0_m2787922779)

  "_SWIGRegisterExceptionCallbacksArgument_AppUtil", referenced from:

      _SWIGExceptionHelper_SWIGRegisterExceptionCallbacksArgument_AppUtil_m386473544 in Bulk_Firebase.App_0.o

     (maybe you meant: _SWIGExceptionHelper_SWIGRegisterExceptionCallbacksArgument_AppUtil_m386473544)

  "_Firebase_App_FirebaseApp_Name_get", referenced from:

      _AppUtilPINVOKE_Firebase_App_FirebaseApp_Name_get_m2545680430 in Bulk_Firebase.App_0.o

     (maybe you meant: _AppUtilPINVOKE_Firebase_App_FirebaseApp_Name_get_m2545680430)

  "_Firebase_App_SetLogFunction", referenced from:

      _AppUtilPINVOKE_Firebase_App_SetLogFunction_m3733654825 in Bulk_Firebase.App_0.o

     (maybe you meant: _AppUtilPINVOKE_Firebase_App_SetLogFunction_m3733654825)

  "_SWIGRegisterStringCallback_AppUtil", referenced from:

      _SWIGStringHelper_SWIGRegisterStringCallback_AppUtil_m4196108411 in Bulk_Firebase.App_0.o

     (maybe you meant: _SWIGStringHelper_SWIGRegisterStringCallback_AppUtil_m4196108411)

  "_Firebase_App_SetEnabledAllAppCallbacks", referenced from:

      _AppUtilPINVOKE_Firebase_App_SetEnabledAllAppCallbacks_m3339389901 in Bulk_Firebase.App_0.o

     (maybe you meant: _AppUtilPINVOKE_Firebase_App_SetEnabledAllAppCallbacks_m3339389901)

  "_Firebase_App_delete_FirebaseApp", referenced from:

      _AppUtilPINVOKE_Firebase_App_delete_FirebaseApp_m1137114670 in Bulk_Firebase.App_0.o

     (maybe you meant: _AppUtilPINVOKE_Firebase_App_delete_FirebaseApp_m1137114670)

  "_Firebase_App_FirebaseApp_DefaultName_get", referenced from:

      _AppUtilPINVOKE_Firebase_App_FirebaseApp_DefaultName_get_m4097276820 in Bulk_Firebase.App_0.o

     (maybe you meant: _AppUtilPINVOKE_Firebase_App_FirebaseApp_DefaultName_get_m4097276820)

  "_Firebase_App_AppEnableLogCallback", referenced from:

      _AppUtilPINVOKE_Firebase_App_AppEnableLogCallback_m3057939313 in Bulk_Firebase.App_0.o

     (maybe you meant: _AppUtilPINVOKE_Firebase_App_AppEnableLogCallback_m3057939313)

  "_SWIGRegisterExceptionCallbacks_AppUtil", referenced from:

      _SWIGExceptionHelper_SWIGRegisterExceptionCallbacks_AppUtil_m1809271624 in Bulk_Firebase.App_0.o

     (maybe you meant: _SWIGExceptionHelper_SWIGRegisterExceptionCallbacks_AppUtil_m1809271624)

  "_Firebase_App_PollCallbacks", referenced from:

      _AppUtilPINVOKE_Firebase_App_PollCallbacks_m784944262 in Bulk_Firebase.App_0.o

     (maybe you meant: _AppUtilPINVOKE_Firebase_App_PollCallbacks_m784944262)

ld: symbol(s) not found for architecture armv7

clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已经找到了解决方案,但到目前为止还没有找到。我试过禁用BitCode,只为一个架构构建,编辑Linker Flags,检查了库搜索路径,但没有运气。

目前,此错误使我无法为iOS构建我的项目。

我正在运行Unity 5.5.0f3,XCode 8.2和Firebase 1.1.0

4 个答案:

答案 0 :(得分:1)

我刚刚弄清楚问题的原因是什么。我目前的设置包括在我的Windows机器上处理项目,然后使用Mac进行构建。我发现我使用的版本控制软件(TortoiseSVN)不会​​自动包含“.a”文件,导致libApp.a和libMessaging.a没有转移到Mac。

答案 1 :(得分:0)

显然,您缺少Firebase库。它不是从统一导出的xcode项目。请检查您是否为其设置了插件导入设置,并选择了ios平台。 请在此处找到有关设置的更多信息https://docs.unity3d.com/Manual/PluginInspector.html

否则,我会在插件开发者网站上搜索或写下他们的支持。

答案 2 :(得分:0)

我认为问题可能是部署目标。在尝试构建ios之前,尝试将它设置为ios 9.0。

它也应该与8.0一起使用,但不是在我认为之前。

答案 3 :(得分:0)

我遇到了这个问题,似乎已经解决了这个问题。

我第一次运行构建时没有安装CocoaPods。这悄然导致了一个无法构建的xcode项目。

安装CocoaPods,删除xcode项目并重新构建。

祝你好运!