Group Group Group Group Group Group Group Group Group Forums

How to Use CocoaPods with Swift

Learn how to install and set up CocoaPods, a Cocoa dependency manager, and how use it to add third-party libraries and frameworks to your Swift projects.

This is a companion discussion topic for the original entry at

Hi Buddy!

 I'm trying my hands on CocoaPods using your tutorial. I'm getting below error in console : 

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
Couldn't download flavours!

I tried to solve this using solution provided in the forum itself but it didn’t worked. I’m using Xcode7.2. Please help!

Try changing NSExceptionDomain to just Exception Domains

I love this tutorial. Using libraries was very confusing for me but thanks to this I am good to go :slight_smile:

Joshua Greene thank you very much for the tutorial has been of great help. :grinning:

Excellent tutorial on how to make use of Cocoapods :thumbsup:

hi, thanks for the wonderful cocoapods tutorial.

I encounter an error “no such module MEProgressHUD” at the end of the tutorial. I checked and the bridging header is there, I am not sure why I still can’t compile and run the ice cream app?

Seeking your advise.


hi, the error is solved, is just a typo error.


I fail at the first hurdle:

sudo gem install cocoa pods

ERROR: While executing gem … (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj

OSX, Xcode 'n everything upto date.
ls -l /usr/bin/xcode* gives


Any thoughts on what’s happening?


Can this be updated?

the version of ‘Alamofire’ in the tut is 2.0.2 but the latest version is something like 3.13 as of this comment. iOS is 9.3 instead of 8…

question: can i omit version numbers in the Podfile? how do I get it to update everything by itself when there are updates to any frameworks or pods or whatever?

I had to install Homebrew first to get the pods to install.

dklimana: I believe not only that it can, but it’s a must. Once I updated my pod file to iOS 9.0 and Alamofire 3.1.3 it was fine, but prior to updating that info it was still throwing secure transport errors. Make sure your target deployment version matches your pod version. Good luck.

BTW, I don’t know much about Ruby, but I believe you can add '~> ’ in front of the Alamofire version and it will attempt to grab the latest version, like so: pod ‘Alamofire’, ‘~> 1.0’ - I haven’t tried this, and as I said I’m not very familiar with Ruby, so anyone feel free to correct me.

Excellent tutorial (y) !!! thanks

Hi, how could I install a pod file on OS X program?
Do I have to write
platform :osx, "10.11" use_frameworks!
at the start of the Podfile?

Wow, what a great tutorial. I had no idea what CocoaPods does. Though I had a few problems when I tried to do the ‘pod init’ thing, I Googled the errors and solved the problem.

Thank you very much!

hi man!
This is a good tutorial for using CocoaPods. I’m just trying to install the cocoa pods on my Mac with sudo gem install cocoa… (on Terminal) but I’ve receive an ERROR: Error installing cocoapods:
activesupport requires Ruby version >= 2.2.2.
Could you or someone guide me to solve this, please?


pod ‘MBProgressHUD’, ‘~> 0.9.0’ install the latest minor version available.
How do I specify to install latest “patch” version available? for eg. 0.9.x

CocoaPods uses semantic versioning, which has the structure



pod ‘MBProgressHUD’, ‘~> 0.9.0’

means “use the latest patch version that’s equal to or greater than 0.9.0.”

For more details about this, see part 1 of this tutorial on How to Use CocoaPods with Swift, which goes into this in more detail. :]

I am getting error even though I had installed cocoapods.

admin$ pod install
[!] Unable to locate the application bundle. Please ensure the application is available and launch it at least once.
Trace/BPT trap: 5

Stuck for few days. any help will be appreciated.

Dear all,
I was reading this really useful tutorial but I have had several problem because Alamofire is now available in version 4.0.1.
I fix it using a different loadFlavors() version
Here my solution

private func loadFlavors() {

// 1
Alamofire.request("", method: .get, parameters: nil, encoding: PropertyListEncoding(format: .xml, options: 0) , headers: nil).responsePropertyList { [weak self] response in
    // 2
    guard let strongSelf = self else {
    var flavorsArray: [[String : String]]! = nil
    // 3
    if (response.result.isSuccess) {
      if let array = response.result.value as? [[String : String]] {
        flavorsArray = array
  // 4
  strongSelf.flavors = strongSelf.flavorFactory.flavorsFromDictionaryArray(flavorsArray)


I hope this could help,
Enjoy your ice-cream

1 Like