Reputation: 8522
I'm trying to include Alamofire in my Swift project following the github(https://github.com/Alamofire/Alamofire#cocoapods) instruction.
I've created a new project, navigated to the project directory and run this command sudo gem install cocoapods
. Then I faced following error:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod
After searching I managed to install cocoapods
by running this command sudo gem install -n /usr/local/bin cocoapods
Now I generate a pod file by pod init
and edited it this way:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'ProjectName' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Law
pod 'Alamofire'
target 'ProjectNameTests' do
inherit! :search_paths
# Pods for testing
end
target 'ProjectNameUITests' do
inherit! :search_paths
# Pods for testing
end
end
Finally I run pod install
to install Alamofire. After that I open the project and import Alamofire
statement gives me following error No such module 'Alamofire'
Update-1: Results of pod install
is:
Analyzing dependencies
Downloading dependencies
Using Alamofire (3.4.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
Upvotes: 12
Views: 21947
Reputation: 1744
2: Select Almofire
3: Search Architecture in build Setting
4: Build Active Active Architecture Only set to No
5: Clean Build and Run.
This work for me.
Upvotes: 0
Reputation: 1490
After a lot of efforts and all solutions provided above. I have fixed on Xcode 13.0:
Use for Simulator: Go to:
- Build settings -> EXCLUDED_ARCHS = arm64
- Build settings -> VALID_ARCHS = arm64e armv7 armv7s arm64 x86_64
Use for Realm Device: Go to:
- Build settings -> EXCLUDED_ARCHS =
- Build settings -> VALID_ARCHS = arm64e armv7 armv7s arm64
Upvotes: 1
Reputation: 23
2021 M1 USERS
according to: https://developer.apple.com/forums/thread/123614?answerId=683594022#683594022
it worked for me hope it works for you.
Upvotes: 1
Reputation: 407
When using Cocoapods to include dependencies always open your .xcworkspace
use_frameworks!
$(inherited)
in both debug and release.Now try a clean build.
Upvotes: 0
Reputation: 969
go to Product -> Scheme -> Manage Schemes... and check Alamofire true this work for me
Upvotes: 8
Reputation: 87
you have to clean project and build, before you can import that library.
Upvotes: 2
Reputation: 220
Sometimes with no reason xcode can't load a module Alamofire. It can happen after a work session, after opening a project. The fix for this is to select a schema -> Alamofire, and run. If the message is "Successful", the schema can be changed back to project and it will work with no problems.
Upvotes: 3
Reputation: 1291
I suggest you to change your pod file like this below:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
pod 'Alamofire', '~> 3.0' <<<---- Alamofire library is cross beetween projects
target 'NotifyM' do
end
target 'NotifyMTests' do
end
target 'NotifyMUITests' do
end
Another thing is use_frameworks!
you should use this if the project is Objective-C
based and try to use Swift
pod library.
UPDATE: for the new cocoapods version 1.x the shared library should be like this:
# There are no targets called "Shows" in any Xcode projects
abstract_target 'Shows' do
pod 'ShowsKit'
pod 'Fabric'
# Has its own copy of ShowsKit + ShowWebAuth
target 'ShowsiOS' do
pod 'ShowWebAuth'
end
# Has its own copy of ShowsKit + ShowTVAuth
target 'ShowsTV' do
pod 'ShowTVAuth'
end
end
as indicated into cocoapods website :http://guides.cocoapods.org/using/the-podfile.html
Upvotes: 2
Reputation:
I suggest that and it's work for me :
platform :ios, '8.0'
use_frameworks!
target 'App' do
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git'
end
After that, run : pod install
in your project repository
Upvotes: 1
Reputation: 6251
Install this way Pod file
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'NotifyM' do
pod 'Alamofire', '~> 3.0'
end
target 'NotifyMTests' do
end
target 'NotifyMUITests' do
end
Upvotes: 1
Reputation: 150
You should tap the Target to select Alamofire and build it once before coding.
Upvotes: 0