ios - Alamofire Getting Response -999 = cancelled using URLRequestConvertible -


i have problem alamofire 3.0, i'm trying data server authentication. when run device iphone 6 ios 9.2.1 have no response, in iphone 6 ios 9.2 simulator have response.

i follow how created in alamofire documentation in : https://github.com/alamofire/alamofire#crud--authorization

appreciate answers.

class apicontroller {

 ...   enum router: urlrequestconvertible {     static let baseurlstring = "link_with_user:password"     static var oauthtoken: string?      case mylisting([string: anyobject])      var method: alamofire.method {         switch self {          case .mylisting:return .get         }     }      var path: string {         switch self {          case .mylisting:             return "listing.php"          }     }      var urlrequest: nsmutableurlrequest {         let url = nsurl(string: router.baseurlstring)!         let mutableurlrequest = nsmutableurlrequest(url: url.urlbyappendingpathcomponent(path))         mutableurlrequest.httpmethod = method.rawvalue          if let token = router.oauthtoken {             mutableurlrequest.setvalue("application/x-www-form-urlencoded", forhttpheaderfield: "content-type")             mutableurlrequest.setvalue("basic \(token)", forhttpheaderfield: "authorization")         }          switch self {         case .mylisting(let parameters):             return alamofire.parameterencoding.url.encode(mutableurlrequest, parameters: parameters).0         default:             return mutableurlrequest         }     } }   func getlisting(){    //this how call enum     alamofire.request(router.mylisting(parameters!))         .responsejson { response in              if let json = response.result.value {                 print("json: \(json)")             }     }    } 

}


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -