Search code examples
iosswiftalamofire

can't call Alamofire.request(...)


This is my Pod file...

# Uncomment the next line to define a global platform for your project
platform :ios, '11.2'

target 'Karaweik' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
pod 'Alamofire'
  # Pods for Karaweik

end

And I only get call AlamofireVersionNumber:

enter image description here


Solution

  • That is an issue regarding this library, but if you add the required code it will work. Add this code for Alamofire and run :

    Alamofire.request("http://api.androidhive.info/contacts/").responseData { (response) -> Void in
    
           let responseJson = String(data : response.result.value!, encoding : String.Encoding.utf8)
           print(responseJson)
     }