0
您好我有IOS應用程序在swift中寫入登錄,並在成功登錄後,應用程序繼續活動,有webView
。在應用程序和webview內的應用程序共享會話 - IOS的Swift
該應用程序和網站共享相同的api。登錄的過程是,當我提供正確username
和password
API返回token
我所管理的應用程序登錄正確使用Alamofire框架作爲HTTP請求
Alamofire.request(.POST, url, parameters: param).responseJSON{ (request, response, JSONdata, error) in
if error != nil {
let result = ["Error" : "Unexpected Error!"]
callback(result: result)
} else {
if response?.statusCode == 401 {
println(401)
let result = ["Error" : "User not found!"]
callback(result: result)
} else if response?.statusCode == 200 {
let responseDict = JSONdata as! NSDictionary
callback(result:responseDict)
}
}
}
,這是我的web視圖代碼
顯示let requestURL = NSURL(string: "myURL")
let request = NSMutableURLRequest(URL: requestURL!)
webView.loadRequest(request)
我需要在webview中顯示它的網站,但我需要與webview共享會話,因爲它們與應用程序共享相同的api。
任何人都可以幫助我嗎?如何實現這一點。
我只想讓應用的用戶已經登錄到webview中,但我不知道如何。 – CaffeineShots