使用Xcode 11.4和Cocoapods进行Mongodb Realm安装会导致错误

时间:2020-10-08 02:28:35

标签: xcode mongodb installation realm

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

*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*

我正在遵循确切的说明,为什么会这样?

1 个答案:

答案 0 :(得分:1)

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

Podfile:

好像缺少某些组件或格式可能不正确(这就是为什么我在评论中问它是否为 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项目,并且该项目正常工作。

还要确保您的椰壳动物也是最新的。要么

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