Maintaining session in after closing UIWebView

别等时光非礼了梦想. 提交于 2019-12-23 00:52:32

问题


I have an application which has a login page resides on the application server. So I open a UIWebView to handle the login. After then I want to switch to the UIView and make API calls using ASIHttp library (others may also be acceptable). The problem is; after I login server keeps session object for authentication purpose, so when I close the UIWebView and switch to a UIView and make an API call, it fails. I believe, somehow I need to maintain session object (set after login) in the API calls. How can I achieve this?


回答1:


Here are the steps I followed:

  • Extract the cookies in UIWebView using NSHTTPCookieStorage class.
  • Send it back using ASIHTTPRequest setRequestCookies: method for the subsequent calls


来源:https://stackoverflow.com/questions/11017831/maintaining-session-in-after-closing-uiwebview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!