Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Realm: Module was created by an older version of compiler and could not build objective-c module

Tags:

ios

swift

realm

enter image description here

I have followed the steps provided to add the framewowrk from this link https://realm.io/docs/swift/latest/

It gives this error what could be the issue?

Is it because it is compiled with an older version of xcode, since I have the latest xcode 7 beta?

If so, how would I solve this?

like image 700
Imran Avatar asked Jan 08 '23 04:01

Imran


2 Answers

You'll have to wait for us to support Swift 2.0 (#2062) before you can use Realm Swift in your Swift 2.0 project.

Because the framework written in Swift which was built in the old version compiler is not able to use in Xcode 7. Therefore, it will be needed to re-build using the compiler of Xcode 7. However, Swift 2 is required on Xcode 7; we are working to adapt RealmSwift.framework to the Swift 2.

like image 160
kishikawa katsumi Avatar answered Jan 12 '23 01:01

kishikawa katsumi


I got Realm to work with Swift 2 by doing the following (this is from memory)

  1. Checkout Swift-2.0 branch https://github.com/realm/realm-cocoa/tree/swift-2.0
  2. Build by running /build.sh ios-swift
  3. Copy Realm.framework and RealmSwift.framework into project
  4. Use let realm = try! Realm() as my initializer in place of let realm = Realm()

I use Carthage for all my frameworks, so to keep things uniform I copied the RealmSwift and Realm frameworks into the carthage/build/ios directory and the /usr/local/bin/carthage copy-frameworks build script picks them up

like image 23
Eric Avatar answered Jan 11 '23 23:01

Eric