【问题标题】:Xcode9 Realm Error - No viable overloaded ‘=’Xcode9 领域错误 - 没有可行的重载'='
【发布时间】:2017-11-10 21:50:46
【问题描述】:

我只是安装了 Xcode 9 并构建了我的原生 iOS 项目。 (用swift写)

该项目在 Xcode 8 中正常,但现在,我收到此错误:

No viable overloaded '='

在文件中:Pods\Pods\Realm\object.cpp

第 42 行 => m_notifier = std::make_shared<_impl::ObjectNotifier>(m_row, m_realm);

【问题讨论】:

  • m_notifier 的类型是什么?可能是基类没有正确重载 = 运算符
  • 感谢您的回复。类型是_impl::CollectionNotifier::Handle<_impl::ObjectNotifier> m_notifier;Object 类中。

标签: c++ ios xcode


【解决方案1】:

如果您使用的是 Cocoapods,请打开 Podfile 并将 RealmSwift 版本设置为 2.8.1(或上面提到的 David 的 2.8.3)。这是我使用 Xcode 9 的 Swift 3.0 的 Podfile:

target ‘<PROJECT>’ do
  use_frameworks!

  # Pods
  ...
  pod 'RealmSwift', '2.8.1'
end

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '3.0'
        end
    end
end

然后,保存文件并运行:

吊舱安装

如果您没有设置特定的 pod 版本(我推荐),请运行以下命令:

pod 更新 RealmSwift

它会自动更新到最新版本 (2.8.3)。

希望它有助于补充大卫的回答。谢谢!

【讨论】:

  • 我的源代码写在Objective-C。所以我使用了pod 'Realm', '2.8.3' 并且有效。
【解决方案2】:

Realm 团队开发了一个新版本,允许您使用 XCode 9 构建您的项目。 只需将您的 Realm 版本更新到至少 2.8.1(当前版本为 2.8.3

https://github.com/realm/realm-cocoa/releases/tag/v2.8.1

2.8.1 的 Realm 发行说明明确指出:

添加对使用 Xcode 9 Beta 1 进行构建的支持。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-24
    • 2018-03-01
    • 1970-01-01
    • 2016-01-19
    • 1970-01-01
    相关资源
    最近更新 更多