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

人气:680 发布:2022-10-16 标签: ios firebase unity3d xcode linker-errors

问题描述

我已使用Firebase Messaging.unitypackage将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,只为一个架构构建,编辑链接器标志,检查库搜索路径,但没有任何成功。

目前,此错误使我无法为iOS生成项目。

我运行的是Unity 5.5.0f3、XCode8.2和Firebase 1.1.0

推荐答案

我刚刚找出问题出在哪里。我目前的设置包括在我的Windows机器上处理项目,然后使用Mac进行构建。我发现我使用的版本控制软件(TortoiseSVN)没有自动包含".a"文件,这导致libApp.a和libMessaging.a无法传输到Mac。

869