-1

I am trying to use Alamofire for my Swift project. The following is the podfile:

platform :ios, '9.0'
target 'CocoaExample' do
use_frameworks!
pod 'Alamofire', '~> 4.4'
end

I have spent around 5-6 hrs searching for solutions and tried but no luck. Please let me know how to resolve the issue to install Alamofire ~4.4.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Jarvis
  • 163
  • 1
  • 13

1 Answers1

0

Follow the below steps to install Pods. As I have just done it in sample project and it works for me :

Before we proceed make sure that you have pods installed on your computer.

  1. With your project directory Open the terminal and hit below command

    pod init

  2. This will create Podfile in same directory.

  3. Open Podfile and add target :

    pod 'Alamofire', '~> 4.4'

  4. fire commmand 'pod install'

This will install pod and it create pod workspace in your project.

  1. close your xcode and go in the same directory. there will be file call yourprojectname.xcworspace . Open this file then you are all set to go.
Balaji Galave
  • 1,066
  • 6
  • 9
  • Thank you for the reply, I did as you said and did 'import Alamofire' in my ViewController.swift, it says "No such module 'Alamofire' ". – Jarvis May 03 '17 at 03:36
  • Make sure had opened project through **yourprojectname.xcworkspace** . Or quit xcode and reopen with **yourprojectname.xcworspace** – Balaji Galave May 03 '17 at 03:44
  • yeah, I opened .xcworkspace only, still I see the error, do I need to add framework in BuildPhases or General -> Binaries ? – Jarvis May 03 '17 at 03:47
  • I don't see "Alamofire Framework" in my Target Dependencies nor "Link Binary with Libraries" nor the "Embedded Binaries". I only see "Pods_CocoaPods.framework" in LinkedFramework and Libraries. – Jarvis May 03 '17 at 03:51
  • Can you see Alamofire library added to your pods project? see it on Pods folder or framework at Products folder. – Balaji Galave May 03 '17 at 03:56
  • yeah I see the "Alamofire" in Pods project > Pods > Alamofire (which has all swift files and support Files folder – Jarvis May 03 '17 at 03:59
  • I am not sure, whats going wrong. I still have the problem. – Jarvis May 03 '17 at 04:05
  • @Jarvis Did you try to build the project? – Eric Aya May 03 '17 at 06:23
  • @EricAya yeah I can see errors only if I build rite! – Jarvis May 03 '17 at 07:17
  • I figured out the issue is my xcode is using Swift 2.2 and Alamofire~ latest version 4.4 is for swift 3+. I updated my xcode and swift version which resolved the issue. Thank you everyone for helping me :) – Jarvis May 03 '17 at 07:18