【问题标题】:Firebase with Unity causing Linker Error in XCodeFirebase 与 Unity 导致 XCode 中的链接器错误
【发布时间】:2017-01-04 14:13:58
【问题描述】:

我已使用 FirebaseMessaging.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、XCode 8.2 和 Firebase 1.1.0

【问题讨论】:

    标签: ios xcode unity3d firebase linker-errors


    【解决方案1】:

    我刚刚弄清楚问题的问题所在。我当前的设置包括在我的 Windows 机器上处理项目,然后使用 Mac 进行构建。我发现我使用的版本控制软件 (TortoiseSVN) 不会自动包含“.a”文件,导致 libApp.a 和 libMessaging.a 无法传输到 Mac。

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

      • 我刚刚仔细检查过,用于 iOS 的插件的插件导入设置设置正确。我也联系了 Firebase 的支持人员,所以我几乎只是在等待解决方案出现在某个地方:)
      【解决方案3】:

      我认为问题可能出在部署目标上。在尝试构建 ios 之前,尝试将其统一设置为 ios 9.0。

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

      【讨论】:

        【解决方案4】:

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

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

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

        祝你好运!

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2017-06-13
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多