1
votes

I am following the To-Do List tutorial on the Realm webpage (https://realm.io/docs/tutorials/realmtasks/) and I am getting the error message when the app crashes: dyld: Library not loaded: @rpath/libswiftCore.dylib Referenced from: /Users/Christian/Library/Developer/Xcode/DerivedData/RealmTasks-cwgtsxxmwhutfobpmwhqvankjefr/Build/Products/Debug/RealmTasks.app/Contents/Frameworks/RealmSwift.framework/Versions/A/RealmSwift Reason: Incompatible library version: RealmSwift requires version 1.0.0 or later, but libswiftCore.dylib provides version 0.0.0 (lldb)

screenshot

There are a number of questions already commented on pointing out that you have to use matching versions for Swift and Realm. I am using Xcode 8.3.2, Swift 3.0.2 and I am using the 3.0.2 versions for Realm and RealmSwift frameworks from the latest download from the realm-mobile-platform directories (6th April 2017).

Might there be something else I am missing here?

3
Is the Realm SDK version swift-2.6.2? And did it download from : static.realm.io/downloads/swift/realm-swift-2.6.2.zip ?Yun CHEN
well, I tried both, the 2.6.2 and the one in the realm-mobile-platform download one - both don't workkangarooChris
Can you please share the complete error message, starting with the "dyld: Library not loaded" portion of it?bdash
dyld: Library not loaded: @rpath/libswiftCore.dylib Referenced from: /Users/Christian/Library/Developer/Xcode/DerivedData/RealmTasks-cwgtsxxmwhutfobpmwhqvankjefr/Build/Products/Debug/RealmTasks.app/Contents/Frameworks/RealmSwift.framework/Versions/A/RealmSwift Reason: Incompatible library version: RealmSwift requires version 1.0.0 or later, but libswiftCore.dylib provides version 0.0.0 (lldb)kangarooChris
"I am using Xcode 8.3.2, Swift 3.0.2 and I am using the 3.0.2 versions for Realm and RealmSwift frameworks" this doesn't line up. Xcode 8.3.2 comes with a Swift 3.1 compiler, and there are no 3.0.2 versions of Realm Objective-C or Realm Swift. The latest Realm versions are at 2.6.2.jpsim

3 Answers

0
votes

“Clean Build Folder” (Command-Option-Shift-K) can occasionally fix issues like these.

0
votes

It looks like our tutorials were slightly out of date, so I just submitted an update in order to make mention of Xcode 8.3 and Swift 3.1. Sorry for the confusion.

To 100% clarify, at the time of this writing, the latest versions of all packages involved are:

  • Xcode Version: 8.3.2
  • Required Swift Version: 3.1
  • Latest Realm Cocoa Release: 2.6.2

In order to integrate Realm Swift into the tasks tutorial for Xcode 8.3, you need to use the swift-3.1 version of the frameworks included in either the latest Realm Swift or Realm Mobile Platform for macOS bundle downloads.

When setting up the Xcode project, make sure to drag both Realm.framework and RealmSwift.framework to the 'Embedded Binaries' section of the Xcode project, and ensure 'Copy Items if Needed' is checked to make sure the framework files are properly copied into the project host directory.

0
votes

I did all the suggestions from various people in this question and it still did not work, but then I found the problem - the Framework Search Path in Build settings is actually hard coded and pointing at the wrong directory. Once I changed the directory to Swift 3.1 it actually started working. If you could update your above Answer then I can tick it off