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

被刻印的时光 ゝ 提交于 2019-12-10 15:45:48

问题


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?


回答1:


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.




回答2:


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




回答3:


This just randomly started happening to me as well for some reason. Manually compiling the swift-2.0 branch didn't end up working at all.

I ended up converting my entire project to Swift 2.1, and using the pre compiled frameworks. Now I'm up and running.

FWIW - The conversion to 2.1 from 2.0 wasn't nearly as painful as any of the other conversions from 1.0, or 1.2.



来源:https://stackoverflow.com/questions/30826785/realm-module-was-created-by-an-older-version-of-compiler-and-could-not-build-ob

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!