sinusGob sinusGob - 3 years ago 175
iOS Question

Alamofire doesn't execute the URL

I have a server running in node, I tried using postman and it works just fine, but when I execute it from IOS client, it doesn't execute the URL, I checked my server it doesn't even called the API

Node server'/api/accounts/login', (req, res, next) => {
var user = new User(): =;
user.pass = req.body.password; => {


let mainURL = ""
let facebookLogin = "\(mainURL)/api/accounts/login"

func loginButtonTapped(_ name: String, _ pass: String) {

let parameters: [String: AnyObject] = [
"name": name as AnyObject,
"password": pass as AnyObject

Alamofire.request(facebookLogin, method: .post, parameters: parameters, encoding: JSONEncoding.default)
.responseJSON { response in
if let value = response.result.value {
let json = JSON(value)

// Do something



To be more specific, I hosted my node server on Heroku, I use namecheap to get the full domain name, but for somehow my ios client doesn't execute the API, do i need to add anything on the Info.plist?

Dix Dix
Answer Source

try this

1.add this code for show error.

else if let ERROR = response.result.error { 

2.Add this code in info.plist file.

  <key>NSAllowsArbitraryLoads</key> <true/> 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download