Cannot add Alamofire to Swift Project
I had the same problem. I was able to fix it by doing the following.
Download the Alamofire "Source" folder.
https://github.com/Alamofire/Alamofire/tree/master/SourceDrag it into your xCode Project, and click "Copy Items if Needed". If you view the project in Finder, the Alamofire Source folder should be in the project itself. (Ex: I have 3 items. Example App, Example App.xcodeproj, Example App Tests. The folder should be in Example App.)
Finally, you should be done! However, now, you do not need to import Alamofire, since you are not actually loading a framework.
For example, instead of doing Alamofire.upload, you will now only do upload.
Cannot install Alamofire in new Xcode Project. No Such module Alamofire
Make sure you haven't added any files from Alamofire to your project except for the Alamofire.xcodeproj
Here is step by step instruction:
- Download and unarchive Alamofire
- Copy the root folder of Alamofire to any subfolder of your project. Libs, for example.
- Drag and drop Alamofire.xcodeproj to your Xcode project
- Open project settings of your project, Build Phases pane, expand Target Dependencies section, and add Alamofire as new dependency
- Open General pane, expand Embedded Binaries section, and add Alamofire.framework
import Alamofire
// in your source fileAlamofire.request(.GET, "http://httpbin.org/get")
// use Alamofire
How to manually add Alamofire into xcode project
The problem is that you are using the latest Alamofire
which is based on Swift 2.2 and you are running on lower Xcode version.
Run your app on Xcode 7.3 with the latest Alamofire
version and your problem will be solved.
Can't import Alamofire
This issue was already reported on Github: https://github.com/Alamofire/Alamofire/issues/441
Possible fixes mentioned there:
- Product -> Clean
- Restart Xcode
Cocoapods: Cannot load module 'Alamofire' as 'Alamofire'
Update: I posted an answer earlier that was wrong.
But now I actually figured it out.
I made a new project, went to the settings menu by clicking on the name of my app in the project explorer.
Then I went to Linked frameworks and libraries
which is at the very bottom of the General
tab.
I pressed that little + icon, selected Alamofire.framework.
and set the status to required
Following this, cleaning and rebuilding the project made the error go away.
Xcode: No Such Module 'Alamofire'
I think you are missing add Alamofire
in your tests targets
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'AppName' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for AppName
pod 'SwiftyJSON'
pod 'Alamofire', '4.4.0'
target 'AppNameTests' do
inherit! :search_paths
pod 'Alamofire', '4.4.0'
end
target 'AppNameUITests' do
inherit! :search_paths
pod 'Alamofire', '4.4.0'
end
end
Better would be
You can also make a configuration with all pods that are commons to your targets
# Uncomment this line to define a global platform for your project
platform :ios, '8.2'
# Uncomment this line if you're using Swift
use_frameworks!
# Define main pods.
def main_pods
#Your common pods here
pod 'Alamofire', '4.4.0'
end
target 'AppName' do
main_pods
#add here other pods specific for this target
end
target 'AppNameTests' do
main_pods
#add here other pods specific for this target
end
target 'AppNameUITests' do
main_pods
#add here other pods specific for this target
end
Hope this helps
Related Topics
Difference Between Text("") and Text(Verbatim: "") Initializers in Swiftui
Swift Sort Dictionary by Value
Play Local Audio File with Avaudioplayer
Nsurlerrordomain with Code=-1100
How Should You Handle Closure Arguments for Uialertaction
Uibarbuttonitem Doesn't Work When Created as a Property, But Does When Created in a Function
Swift 3 Optional Trouble. Can't Unwrap Url with Passed in String
Sort Array of Objects by Two Properties
Macos Command Line Tool with Swift Cocoa Framework: Library Not Loaded
Swiftui - Add Border to One Edge of an Image
iOS 11 Large Title Navigation Bar Snaps Instead of Smooth Transition
Using Scenekit in Swift Playground
Adding Swift 3 Packages to Xcode 8 Using the Swift Package Manager
How to Manage Swiftui State with Nested Structs
Create View Based Nstableview Programmatically Using Bindings in Swift