I'm on the very latest Xcode 7.1 and my project uses Swift 2.1. I followed all the directions on the Swift website for getting started (Dynamic Framework tab) and everything builds just fine until I try to import RealmSwift
in my class. The compiler throws the following error on the line I try to import RealmSwift:
error: module file was created by an older version of the compiler; rebuild 'RealmSwift' and try again: /Users/USERNAME/Desktop/iosDev/PROJECTNAME/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule
All the files are in the ${PROJECT_DIR}
root (RealmSwift.framework
and Realm.framework
).
I have searched and searched for an answer, updated Xcode, deleted and reconfigured the library. I'm not sure what it means by 'rebuild RealmSwift' (I'm new to swift). The error only throws when I try to use the library in my class or use the Xcode plugin to create a new Realm Model Object.
Realm Swift 0.96.2 was released on October 26 2015, adding support for Xcode 7.1 and Swift 2.1 This should address the issue you were seeing. Releases of Realm prior to 0.96.2 were built with Xcode 7 and supported Swift 2.0.
I am also using Realm in the latest version of Swift, but instead of the Dynamic Framework method, I use the Cocoapods version of the installation.
This works for me.
But anyway, this of course doesn't solve your problem :).
Most of the time this error can be solved by just cleaning your project. In the Xcode menu, Select Product
and then Clean
. I had this same error with some SQLite libraries I was using and this fixed it most of the time.
Clone the repo or download as a Zip file and open: https://github.com/realm/realm-cocoa
Open up a terminal window (mac) or some comparable alternative.
Then, run this command: REALM_SWIFT_VERSION=2.1 sh build.sh build which will cause the project to be updated to Swift 2.1
Then, you'll be able to drag the frameworks back into your Project.
REALM_SWIFT_VERSION - Change with your build Version of Swift (hear latest Version of Swift is 2.1).
This Take Some Minutes to Build with Your Specific Version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With