Created
April 12, 2015 14:55
-
-
Save Baekjoon/bafb8d227393faccdff5 to your computer and use it in GitHub Desktop.
ssodam-login
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func login(#username: String, password: String) { | |
println("로그인 시작: \(username)"); | |
var manager = AFHTTPRequestOperationManager(); | |
var params: [String: AnyObject] = ["id": username, "pass": password, "auto": false]; | |
manager.POST("https://www.ssodam.com/loginCheck", parameters: params, success: { (operation: AFHTTPRequestOperation!, responseObject: AnyObject!) -> Void in | |
println("response Object: \(responseObject)"); | |
var d = responseObject as! [String: AnyObject] | |
if let t = d["type"] as? Int { | |
if t == 0 { // 로그인 실패 | |
println("로그인 실패"); | |
println(d["msg"]!); | |
} else { | |
self.loginSuccess(); | |
} | |
} | |
}) { (operation: AFHTTPRequestOperation!, error: NSError!) -> Void in | |
println("\(error.description)"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment