0
votes

I'm taking over development of a project and am unable to contact the previous developer. I'm trying to figure out which versions of the imbedded open source libraries were used. The project appears to be in Swift 2.1. I am attempting to compile it with Xcode 7.3.1. Carthage was the package manager used. I'm stuck on an error with RealmSwift. The error occurs on the line that tries to import RealmSwift.

/{app source path}/PersonnelModel.swift:10:8: Module file was created by a newer version of the compiler: /{app source path}/Carthage/Build/iOS/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule

I have worked my way all the way back to version 0.96.2 of realm-cocoa, which I believe is the first version to support Xcode 7.1 and Swift 2.1. However, I'm still getting the error.

I have looked through other answers on here, but have not found a solution that works. Am I misunderstanding the cause of the error? I just thought it was picking up a newer version of the framework.

Here is what my Cartfile looks like:

github "ReactiveCocoa/ReactiveCocoa"
github "Alamofire/Alamofire" ~> 3.4
github "SwiftyJSON/SwiftyJSON"
github "realm/realm-cocoa" == 0.96.2
github "scalessec/Toast-Swift" ~> 1.4.0
2
Have you just tried building your app with Xcode 8? - Gruntcakes
@Grunt Yes. Lots and lots of errors relating to Swift 2.2/3.0 differences. I'll eventually have to migrate it, but would just like to get a clean compile for now. - Lastmboy
Just because you use Xcode 8 doesn't mean you have to compile for Swift 3. - Gruntcakes
How do I get it to compile to Swift 2.2 in Xcode 8? It always wants to update the code to Swift 3. - Lastmboy
When you open the project there is a dialog asking to covert to Swift 3. There is a Later button. You can't build Swift 2.1 in Xcode 8 but the upgrade to 2.3 should be small. See thatthinginswift.com/swift-2-xcode-8 - Gruntcakes

2 Answers

1
votes

If you're just trying to get a clean compile for now, it might be worth taking Realm out of Carthage, installing it manually as a dynamic framework, and then putting it back into Carthage at the end once you've got everything smoothed out.

Xcode 7.3.1 was Swift 2.2. The very latest version of Realm to support Swift 2.2 is version 2.3.0, so I'd recommend downloading that version and manually importing it into Xcode 7.3.1

As an aside, Realm has dropped support for Swift 2 starting with version 2.4.0, so it's greatly recommended you migrate your codebase to Swift 3 as soon as possible. :)

0
votes

I had this issue today in Xcode 8.3.2 w Swift 3. I mistakenly tried to run the swift 3 converter on one class file and canceled it mid run. Xcode then threw this error for one of my Pods (Bolts). Fix was to remove the pod, run pod update, then add the pod back, run pod update again so the module was reset.