Alamofire for Swift 1.2 generates error - ios

After upgrading to the latest build of Xcode and downloading the newest Alamofire release, I am getting the following error:
Module file was created by an older version of the compiler
With the previous version of Alamofire I added the entire AF project into my app as recommended, however the install guide for the latest version of AF says just to copy the .swift file into the project.
I am still calling import Alamofire in the file that requires it. This is also where the error appears. If I remove the import my project generates 86 additional errors.

For me Cleaning up the Build folder Cmd ⌘ + Alt ⌥ + Shift ⇧ + K worked.

Alamofire is updated now for Xcode 6.3, until I know its creator merge the branch for Xcode 6.3 into the branch master in Github , you have to download it to correct the errors for the new Xcode.
But I strongly recommend you installing Alamofire using CocoaPods, I think is better, it's up to you.
I hope this help you.

Related

Migrating from Cocoapods to Swift Package Manager but import module failed

recently I'm refactoring a project which uses Cocoapods to manage dependencies (a lot of dependencies...), since Xcode 11 integrated Swift Package Manager, I want to migrate progressively some dependencies to SPM staring from the framework Alamofire.
After I removed the Alamofire from the Podfile (delete and run pod install) and added it into SPM,
I got the error No such module 'Alamofire'.
I've already tried to clean build and removed derived data but none of them can fix it.
Did anyone have this problem too?
After few days searching, I found out this https://stackoverflow.com/a/57312755/863020.
Seems that SPM could be only used for Debug and Release configurations, if we want to use it with more configurations then we should write a pre-action. And it is also a known issue on Xcode so I would not use SPM for now :(
UPDATED on dec. 12
So I come back to my question after the new release of Xcode 11.3, it fixed this issue and now I can build the project with custom build configuration :)

No Such Module 'Alamofire','SwiftyJson','UiKiT'

I am getting this build error on an existing project when I try to build project.
no such module 'Alamofire'
When I remove that line, then it start point to swiftyJson as
no such module 'SwiftyJson'
and when i remove that line and build again it start pointing UiKit as
no such module UiKit
Yesterday, I updated my xcode to 10.3 as I got a new update so installed that and after that I am getting this issue.
Then I downloaded previous version xcode 10.2.1 from apple developer site and now again I am getting this issue.
When I make a new project there is no issue like this.
i have tried reinstalling pods after some sort of search but not getting rid of this error.
delete derived data: go to Xcode -> preferences -> Locations -> then delete derived data
if that doesn't work try restarting your mac
Clean the project with 'command + shift + K'
or
if your project is uploaded in git repository, just remove whole project to trash and clone it

Xcode 9.1 : module compiled with Swift 4.0 cannot be imported in Swift 3.2.2

I updated xCode from 9.0.1 to 9.1. Everything was ok before, but now, I have this error when I try to build my project (with Carthage) :
module compiled with Swift 4.0 cannot be imported in Swift 3.2.2 (or 4.0.2 for SWIFT 4 users)
Don't need to let you know the module because it doesn't depend on it (because when I comment the import line concerned, the mistake his misplaced to the next import, so for another module).
I tried everything I saw :
Clean the project
Clean the Carthage folder
Clean Derived Data folder:
rm -rf ~/Library/Caches/org.carthage.CarthageKit/DerivedData
Update with Carthage: carthage update --platform iOS (with or not --no-use-binaries)
Update Modules
Build again
Close and Reopen Xcode
pray
Carthage (0.26.2) and MacOS (High Sierra) are up to date.
So, my last supposition (as I can read) is that Xcode 9.1 not allow us to use modules not build with Xcode 9.1. So I can come back to Xcode 9.0.1 but I will unable to deliver my project to Xcode 9.1 users. I cannot imagine to wait the update of all the modules. So do you have an idea, please ?
Thanks you !
Yes, you have to upgrade every framework you are using to 9.1.
"As I said, it doesn't depend on the module because if I comment one import, it's the import of another one who have troubles"
That's because the next one has the exact same problem. Just replace all your frameworks in the "Embedded Binaries" with versions that have been compiled with 9.1. To prove it to yourself, do it on the first one it complains about, and Xcode will then tell you the second one is now the problem, etc.

Module file was created by a newer version of the compiler

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
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. :)
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.

Swift including JustHTTP/Just build fail

I am using XCode6.4 and I imported JustHTTP/Just (https://github.com/justhttp/Just) library using Carthage.
Import worked fine and here is a screenshot of my xcodeproj file
But on this line:
import Just
I am getting this error
Module file was created by a newer version of the compiler
...../Carthage/Build/iOS/Just.framework/Modules/Just.swiftmodule/x86_64.swiftmodule
Can someone advice? Thanks!
The default branch (v0.3) is on Swift 2. So I had to either switch to Xcode 7 or use github "JustHTTP/Just" ~> v0.1 in my Cartfile.

Resources