【问题标题】:Linker error while building firebase ios sdk binding for xamarin ios为 xamarin ios 构建 firebase ios sdk 绑定时出现链接器错误
【发布时间】:2014-11-02 18:32:30
【问题描述】:

我在 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
{
}

但我仍然得到错误

【问题讨论】:

  • 这个lib有什么变化吗? stackoverflow.com/questions/20343786/…
  • 是的,但那是一个非常古老的帖子。我正在使用最新版本的 sdk,因为它是
  • 但是你添加了那个库“libc++.dylib”吗?
  • 我做了 - LinkerFlags = "-ObjC -fobjc-arc -licucore -lc++"
  • 另一个更新,这在模拟器中有效,但无法在设备上部署 - iphone 5s

标签: xamarin.ios xamarin firebase


【解决方案1】:

尝试添加

SmartLink = true

x.linkwith.cs 文件

并从您的ApiDefinition.cs删除

[BaseType(typeof(NSObject))]
interface FirebaseHandle
{
}

【讨论】:

    猜你喜欢
    • 2013-07-09
    • 1970-01-01
    • 2014-06-27
    • 2020-07-19
    • 1970-01-01
    • 1970-01-01
    • 2013-07-17
    • 2013-06-19
    • 2016-10-07
    相关资源
    最近更新 更多