2016-07-05 72 views
-4

這裏發送JSON字符串是我的代碼:在AlamoFire

let str :String = "{"emailId":"\(id)","password":"\(pass)"}" 

Alamofire.request(.GET, "http://constructionapp.dev04.vijaywebsolutions.com/proroffingservice.asmx?op=wsUserLogin", parameters: ["json":str]) 
      .responseJSON{response in 
       self.arrresult = JSON(response.result.value!)} 
+0

'讓PARAM = [ 「uid」:uid,「password」:password] Alamofire.request(.POST,「http://constructionapp.dev04.vijaywebsolutions.com/proroffingservice.asmx?op=wsUserLogin」,參數:param,encoding:.JSON ,標題:無) .responseJSON {(response)in self.arrresult = JSON(response.result.value!) }' – childrenOurFuture

回答

-2

也許您正在使用的參數搜索詞典:

func fetchUser() 
{ 
    guard let emailId = IDtxt.text, password = passtxt.text else {return} 

    var parameters = [String: String]() 
    parameters["emailId"] = emailId 
    parameters["password"] = password 

    Alamofire.request(.GET, "http://constructionapp.dev04.vijaywebsolutions.com/proroffingservice.asmx?op=wsUserLogin", parameters: ["json": parameters]).responseJSON 
     { 
      response in 
      if let result = response.result.value 
      { 
       self.arrresult = JSON(result) 
      } 
     } 
} 

最好去閱讀Alamofire手動

+0

感謝您的回覆..... –

+0

但我想發送這整個{「emailId」:「\ (id)「,」password「:」\(pass)「}帶花括號 –

+1

@NikhilGangurde請閱讀Alamofire手冊和快速基礎知識。 –