2016-11-23 9 views
0
func authenticateUser() 
{  

    Alamofire.request("http://dev.myvmanager.com/vManagerMobileWebService/api/vMobile/Authenticate_iNotifications?username=ssrikanth&password=bA2135&device=iPhone&device_token=iPhone&[email protected])[email protected]").responseJSON 
     { 
      response in 
      debugPrint(response)  
    } 
} 

答えて

2

https://github.com/SwiftyJSON/SwiftyJSONと例を見てください。ただ、JSON詳細については

let json = JSON(data: actualData) 
if let userName = json[0]["login_name"].string { 
    //Now you got your value 
} 

からデータを取得

Alamofire 
     .request("http://dev.myvmanager.com/vManagerMobileWebService/api/vMobile/Authenticate_iNotifications?username=ssrikanth&password=bA2135&device=iPhone&device_token=iPhone&[email protected])[email protected]") 
     .responseJSON { response in 
      debugPrint(response) 
      if let actualData = response.data { 
       let json = JSON(data: actualData) 
       debugPrint(json) 
      } 
    } 

SwiftyJSONと入力からの応答データをこのコンストラクタを使用していますプロジェクト。私は上記の行を実装する場合ここで

もJSONマッパーの素敵な比較である

https://github.com/bwhiteley/JSONShootout

+0

、私はこの ようなエラーは「予想引数の型のデータに型データ応答の値を変換することはできません」を取得 –

+0

@SachitPhilipそれをテストした後、私はこのエラーを受け取りました_タイプ 'DataResponse 'の値を期待される引数型 'Data'_に変換できません - >私は私の答えを更新し、うまくいけばうまくいくはずです – KaraBenNemsi

+0

@ KaraBenMemsi 今、 [ { "説明":ヌル、 "メッセージ":ヌル、 "vmanager_account": "真"、 "USER_ID": "174"、 "のlogin_name": "ssrikanth"、 "USER_NAME":「スーリヤスリカンス " "OWNER_ID": "1"、 "USER_EMAIL": "[email protected]"、 "CUSTOMER_ID": "20"、 "vmanager_cc": "真"、 "vmanager_tp":" 真」、 "CUSTOMER_NAME": "VCOMソリューション"、 "is_so": "0" 私はthis..for例から値を取得したい場合は } ] が思う "のlogin_name" どうすればいいですか? –

関連する問題