这是因为我有一个简单的请求:
Alamofire.request(.POST,loginURL,parameters: ["fb_id": fbId,"fb_access_token": fbToken]) .responseJSON { response in //print(response.request) // original URL request //print(response.response) // URL response //print(response.data) // server data //print(response.result) // result of response serialization if let JSON = response.result.value { print("loginURL - JSON: \(JSON)") } }
此请求响应与cookie会话,我需要做其他请求的安全性原因;奇怪的是,像魔术一样,我已经可以在第一次POST之后执行其他请求,而无需手动读取cookie并存储它.我确定其他请求需要cookie会话,因为他们在邮递员失败,但不在这里.
这只是一个功能?因为在GitHub page官方,我也找不到任何东西.
解决方法
由于其github页面在Advanced Usage部分下面所示:
Alamofire is built on NSURLSession and the Foundation URL Loading System. To make the most of this framework,it is recommended that you be familiar with the concepts and capabilities of the underlying networking stack.
在Manager部分:
Top-level convenience methods like Alamofire.request use a shared instance of Alamofire.Manager,which is configured with the default NSURLSessionConfiguration.
而NSURLSessionConfiguration reference的defaultSessionConfiguration()则说:
The default session configuration uses a persistent disk-based cache (except when the result is downloaded to a file) and stores credentials in the user’s keychain. It also stores cookies (by default) in the same shared cookie store as the NSURLConnection and NSURLDownload classes.