使用Firebase Unity SDK的Firebase Xcode链接器命令错误 [英] Firebase Xcode linker command error using Firebase Unity SDK
问题描述
Unity 5.5.0p4
XCode 8.2.1使用来自Firebase的身份验证和数据库时在XCode中构建项目时出现以下错误:
$ b
架构arm64的未定义符号:
_OBJC_CLASS _ $ _ FIRGoogleAuthProvider,引用自:
objc- libAuth.a中的class-ref(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
_OBJC_CLASS _ $ _ FIRGitHubAuthProvider,引用自:
libAuth.a中的objc-class-ref(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
_OBJC_CLASS _ $ _ FIREmailPasswordAuthProvider引用自:
libAuth.a中的objc-class-ref(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
_OBJC_CLASS _ $ _ FIRFacebookAuthProvider,引用自:
objc-class-ref in libAuth.a(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
_OBJC_CLASS _ $ _ FIRApp,引用自:
libApp.a中的objc-class-ref(app_ios_c76c7 d869e568a9b561ea55e25a7dcc0.o)
_OBJC_CLASS _ $ _ FIRAuth,引用自:
libAuth.a中的objc-class-ref(auth_ios_3c64a79cf1eb3f06f9309f4d8e91ee94.o)
_OBJC_CLASS _ $ _ FIRTwitterAuthProvider ,引用自:
libAuth.a中的objc-class-ref(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
_OBJC_CLASS _ $ _ FIROptions,引用自:
libApp中的objc-class-ref。 a(app_ios_c76c7d869e568a9b561ea55e25a7dcc0.o)ld:symbol(s)not
找到了架构arm64 clang:错误:linker命令失败,
退出代码1(使用-v来查看调用)
我错过了XCode的东西吗?或者有什么需要检查的Unity?
谢谢!
首先,感谢所有分享你的(努力)工作!
关于这个问题已经有很多人说过了,但是我花了一大笔钱。的时间和一大堆的反复试验来收集所有这些SO& Unity论坛,所以我只会发布最终解决方案,最终解决了所有的问题,使用统一云构建/ Unity 5.6.0f3 / Xcode 8.0,该项目只使用Firebase分析包
UNITY CLOUD BUILD
解决方案- 完全禁用Unity的cocoapods>资产> Play服务解析器> iOS解析器>设置(取消选中Podfile生成和在编辑器中自动安装Cocoapod工具,选择无 - 不集成Cocoapods)
p - 将GoogleServices-Info.plist放入UnityAssets文件夹
- PostBuildProcessor方法:
私有静态无效ProcessPostBuild(BuildTarget buildTarget,字符串路径)
{
//只对iOS执行这些步骤
#if UNITY_IOS
Debug.Log([UNITY_IOS] ProcessPostBuild - 添加Google Analytics框架);
//获取pbxproj文件
string projPath = path +/Unity-iPhone.xcodeproj/project.pbxproj;
// PBXProject类表示一个项目的构建设置文件,
//这里是如何读取。
PBXProject proj = new PBXProject();
proj.ReadFromFile(projPath);
//这是生成项目中的Xcode目标
string target = proj.TargetGuidByName(Unity-iPhone);
proj.AddBuildProperty(target,OTHER_LDFLAGS,-ObjC);
proj.AddBuildProperty(target,OTHER_LDFLAGS,-v);
proj.SetBuildProperty(target,ENABLE_BITCODE,NO);
if(!File.Exists(path +/GoogleService-Info.plist))
{
FileUtil.CopyFileOrDirectory(Assets / GoogleService-Info.plist,路径+/GoogleService-Info.plist);
string guid = proj.AddFile(GoogleService-Info.plist,GoogleService-Info.plist);
proj.AddFileToBuild(target,guid);
//将被添加到项目的框架列表
List< string> frameworks = new List< string>(){
AddressBook.framework,
AdSupport.framework,
CoreData.framework,$ b $SystemConfiguration.framework,
};
$ b $ //按名称添加
frameworks.ForEach((framework)=> {
proj.AddFrameworkToProject(target,framework,false);
}) ;
//将被添加到项目的框架列表
List< string> usrLibFrameworks = new List< string>(){
libsqlite3.tbd,
libz.tbd,
libicucore.tbd,
};
$ b $ //按名称添加
usrLibFrameworks.ForEach((framework)=> {
proj.AddFileToBuild(target,proj.AddFile(usr / lib /+框架,Frameworks /+框架,PBXSourceTree.Sdk));
});
//将PBXProject对象写回文件
proj.WriteToFile(projPath);
#endif
}
sdk需要这样的黑客工作(UCB是我们的绝对要求,我猜大多数多平台的移动开发者),我希望所有这些解决方法很快就没用了,但是从官方firebase Unity的开始支持,我不会在这上面算太多的。
Firebase Unity SDK 1.1.1. Unity 5.5.0p4 XCode 8.2.1
When using Authentication and Database from Firebase I get the following error when building the project in XCode :
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FIRGoogleAuthProvider", referenced from: objc-class-ref in libAuth.a(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
"_OBJC_CLASS_$_FIRGitHubAuthProvider", referenced from: objc-class-ref in libAuth.a(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
"_OBJC_CLASS_$_FIREmailPasswordAuthProvider", referenced from: objc-class-ref in libAuth.a(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
"_OBJC_CLASS_$_FIRFacebookAuthProvider", referenced from: objc-class-ref in libAuth.a(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
"_OBJC_CLASS_$_FIRApp", referenced from: objc-class-ref in libApp.a(app_ios_c76c7d869e568a9b561ea55e25a7dcc0.o)
"_OBJC_CLASS_$_FIRAuth", referenced from: objc-class-ref in libAuth.a(auth_ios_3c64a79cf1eb3f06f9309f4d8e91ee94.o)
"_OBJC_CLASS_$_FIRTwitterAuthProvider", referenced from: objc-class-ref in libAuth.a(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
"_OBJC_CLASS_$_FIROptions", referenced from: objc-class-ref in libApp.a(app_ios_c76c7d869e568a9b561ea55e25a7dcc0.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)Do I miss something in XCode? Or have something to check in Unity?
Thanks!
解决方案First, thanks to all for sharing your (hard) work !
A lot has been said on the subject, but it took me a lot of time and a lot of trial and error to gather all the pieces on both SO & Unity forums, so I will just post the solution that I finally worked out, which finally solved all issues for me, using unity cloud build/Unity 5.6.0f3/Xcode 8.0, the project using only firebase analytics package
SOLUTION FOR UNITY CLOUD BUILD
- completely disable cocoapods from Unity > Assets > Play Services Resolver > iOS Resolver > Settings (uncheck "Podfile Generation" and "Auto Install Cocoapod Tools in Editor", choose "None - do not integrate Cocoapods") p
- put GoogleServices-Info.plist in the Unity "Assets" folder
- PostBuildProcessor method:
private static void ProcessPostBuild (BuildTarget buildTarget, string path) { // Only perform these steps for iOS builds #if UNITY_IOS Debug.Log ("[UNITY_IOS] ProcessPostBuild - Adding Google Analytics frameworks."); // Go get pbxproj file string projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj"; // PBXProject class represents a project build settings file, // here is how to read that in. PBXProject proj = new PBXProject (); proj.ReadFromFile (projPath); // This is the Xcode target in the generated project string target = proj.TargetGuidByName("Unity-iPhone"); proj.AddBuildProperty(target, "OTHER_LDFLAGS", "-ObjC"); proj.AddBuildProperty(target, "OTHER_LDFLAGS", "-v"); proj.SetBuildProperty(target, "ENABLE_BITCODE", "NO"); if (!File.Exists(path + "/GoogleService-Info.plist")) { FileUtil.CopyFileOrDirectory("Assets/GoogleService-Info.plist", path + "/GoogleService-Info.plist"); } string guid = proj.AddFile("GoogleService-Info.plist", "GoogleService-Info.plist"); proj.AddFileToBuild(target, guid); // List of frameworks that will be added to project List<string> frameworks = new List<string>() { "AddressBook.framework", "AdSupport.framework", "CoreData.framework", "SystemConfiguration.framework", }; // Add each by name frameworks.ForEach((framework) => { proj.AddFrameworkToProject(target, framework, false); }); // List of frameworks that will be added to project List<string> usrLibFrameworks = new List<string>() { "libsqlite3.tbd", "libz.tbd", "libicucore.tbd", }; // Add each by name usrLibFrameworks.ForEach((framework) => { proj.AddFileToBuild(target, proj.AddFile("usr/lib/"+ framework, "Frameworks/" + framework, PBXSourceTree.Sdk)); }); // Write PBXProject object back to the file proj.WriteToFile (projPath); #endif }
PS it's crazy that firebase unity sdk is requiring such hacks to work (UCB is an absolute requirement for us and I guess for most multiplatform mobile developers) and I hope all those workarounds will soon be useless, but judging that all those issues are here from the beginning of official firebase Unity support, I wouldn't count too much on it
这篇关于使用Firebase Unity SDK的Firebase Xcode链接器命令错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!