【问题标题】:Mongodb Realm installation using Xcode 11.4 with Cocoapods causes error使用带有 Cocoapods 的 Xcode 11.4 安装 Mongodb Realm 会导致错误
【发布时间】:2020-10-08 02:28:35
【问题描述】:

我使用 xcode 11.4 创建了一个新的 Swift 应用程序,我正在尝试按照文档 (https://docs.mongodb.com/realm/ios/install/#ios-install) 中的说明为 Mongodb Realm 安装 pod。但是当我执行“pod install”时,我收到了这个错误:

*Installing Realm (10.0.0-beta.6)
[!] /bin/bash -c 
set -e
sh build.sh cocoapods-setup
Downloading dependency: sync 10.0.0-beta.14 from https://static.realm.io/downloads/sync/realm-sync-cocoa-10.0.0-beta.14.tar.xz
Undefined symbols for architecture x86_64:
  "___isPlatformVersionAtLeast", referenced from:
      realm::util::(anonymous namespace)::ensure_reclaimer_thread_runs() in librealm-sync-ios-dbg.a(file_mapper.o)
      realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in librealm-sync-ios-dbg.a(terminate.o)
      realm::util::network::SecureTransportErrorCategory::message(int) const in librealm-sync-ios-dbg.a(network_ssl.o)
      realm::util::network::ssl::Stream::verify_peer() in librealm-sync-ios-dbg.a(network_ssl.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)*

我的 podfile 是按照说明:

*platform :ios, '12.0'
target 'TEST' do
  
  use_frameworks!
  
  pod 'RealmSwift', '=10.0.0-beta.6'
end*

我按照确切的说明进行操作,为什么会发生这种情况?

【问题讨论】:

  • 也用 Xcode 10.1 试过了,还是不行
  • 也试过这个:pod 'RealmSwift', '=10.0.0-rc.1',在本安装指南中提到docs.mongodb.com/realm/ios/install .....还是不行
  • 那是 exact podfile 吗?没有跳过任何行?
  • 是的,确切的 potfile,也用旧版本的 pod 'RealmSwift','=10.0.0-beta.5' 尝试过,仍然无法正常工作。

标签: xcode mongodb installation realm


【解决方案1】:

我会说问题可能是 podfile 或 XCode 最初是从另一个位置(如磁盘映像或下载文件夹)启动的和/或安装了多个 XCode 版本。

Podfile:

看起来它缺少某些组件或格式错误(这就是为什么我问它是否是我的 cmets 中的 exact podfile)

它应该是这样的

project 'Test.xcodeproj'
target 'Test' do
  use_frameworks!
  pod 'RealmSwift', '=10.0.0-beta.6'
  #                   ^^^  or whatever the current vers is
end

我刚刚用这个 podfile 构建了一个全新的 MongoDB Realm 项目,它工作正常。

还要确保您的 cocoapods 也是最新的。要么

sudo gem install cocoapods

或者为我们处理错误

sudo gem install -n /usr/local/bin cocoapods

确保您的 pod 是最新的,以确保您可以访问最新的 Realm 版本

pod repo update

XCode:

如果它最初是从另一个位置启动的,它将不知道它的文件在哪里。修复方法是从 AppStore 删除并重新安装和/或在终端中将其文件重新对齐:

xcode-select --switch /Applications/Xcode.app

【讨论】:

  • 刚刚关注了您的 cmets,但仍然出现相同的错误消息。错误消息中让我感到困惑的是这部分“架构 x86_64 的未定义符号:” - 这怎么可能?这是不是 iOS 的 pod 吗?
  • @kangarooChris 我尝试了两个项目;在一台装有 macOS 10.14 (Mojave) 和 XCode 11 的 Mac 上,以及另一台装有 10.15 (Catalina) 和 XCode 12 的 Mac 上。这两个项目都是针对 iOS 的。我还构建了两个 macOS 项目,它也适用于此。两个建议;确保在添加 pod 时完全退出 XCode。此外,您可能有旧版本的 cocoapods。尝试更新它。
  • @kangarooChris 仍然无法工作有点模糊。您是在原始问题中使用 podfile 还是在我的问题中使用 podfile?您现在使用的是哪个版本的 XCode - 仍然是 11?我刚刚在我的答案中构建了另一个项目 (macOS) 10.14、XCode 11 和 podfile 的副本/粘贴,它工作正常,因此您的环境和我的环境之间存在一些差异。
  • 我正在遵循您的确切指示。我已将 CAtalina 更新到最新版本 10.15.7 。我正在使用 Xcode 11.4.1 。今天更新到12点。另外,我向 mongrodb Realm 团队提出了一张票。
  • @kangarooChris 我不知道票是否会有所帮助,因为它对其他人有用,但对您无效。这表明您的环境中存在问题。今天早上,我使用更新 10.0.0 的 MongoDB Realm 构建了另一个新项目,它运行良好。您可以使用当前的 podfile 和有关该项目的其他版本详细信息来更新您的问题吗?哦,你需要确保你的 pod 也是最新的,pod repo update
猜你喜欢
  • 2021-05-10
  • 2018-09-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-01-31
  • 1970-01-01
  • 2013-05-24
  • 1970-01-01
相关资源
最近更新 更多