我已经在xamarin中为最新的firebase sdk创建了ios绑定。我添加了以下
[assembly: LinkWith("Firebase.a", LinkTarget.Simulator | LinkTarget.ArmV7, ForceLoad = true, Frameworks = "CFNetwork Security SystemConfiguration", LinkerFlags = "-ObjC -fobjc-arc -licucore -lc++")]
当我编译时,在“编译到本机代码”阶段,编译器错误输出以下消息:
error MT5211: Native linking failed, undefined Objective-C class: _OBJC_CLASS_$_FirebaseHandle. If '_OBJC_CLASS_$_FirebaseHandle' is a protocol from a third-party binding, please check that it has the [Protocol] attribute in its api definition file, otherwise verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
知道为什么会这样吗?
[更新]
进一步分析,我发现firebase sdk的头文件之一有以下条目
typedef NSUInteger FirebaseHandle;
我在ApiDefinition.cs文件中添加了相应的绑定信息
[BaseType(typeof(NSObject))]
interface FirebaseHandle
{
}
但我仍然得到错误
答案 0 :(得分:2)
尝试添加
SmartLink = true
到x.linkwith.cs
文件
ApiDefinition.cs
的和删除
[BaseType(typeof(NSObject))]
interface FirebaseHandle
{
}