kangarooChris
kangarooChris

Reputation: 768

Mongodb Realm installation using Xcode 11.4 with Cocoapods causes error

I created a new Swift app with xcode 11.4 and I am trying to install the pod for Mongodb Realm as per the instructions in the documentation (https://docs.mongodb.com/realm/ios/install/#ios-install). But when I do "pod install" I am getting this error:

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

My podfile is as per instructions:

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

I am following the exact instructions and so why is this happening?

Upvotes: 0

Views: 398

Answers (1)

Jay
Jay

Reputation: 35648

I would say the issue could be the podfile or that XCode was initially launched from another location (like a disk image or the downloads folder) and/or there are multiple XCode versions installed.

Podfile:

Looks like it's missing some components or may be malformed (which is why I asked if it was the exact podfile in my comments)

Here's what it should look like

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

I just built a brand new MongoDB Realm project with this podfile and it worked correctly.

Also ensure your cocoapods is up-to-date as well. Either

sudo gem install cocoapods

or for us dealing with an error for that

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

Be sure you can access the latest Realm versions by ensuring your pods are up-to-date

pod repo update

XCode:

If it was initially launched from another location is won't know where it's files are. The fix is a delete and reinstall from the AppStore and/or realigning it's files with this in terminal:

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

Upvotes: 1

Related Questions