Is it possible to share AFNetworking
session with UIWebView? I used AFNetworking
to login to remote server, but the UIWebView have no idea about the session being created by AFNetworking
?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- back button text does not change
- iOS (objective-c) compression_decode_buffer() retu
- how to find the index position of the ARRAY Where
相关文章
- 现在使用swift开发ios应用好还是swift?
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- didBeginContact:(SKPhysicsContact *)contact not in
- Custom Marker performance iOS, crash with result “
- Why is my library not able to expand on the CocoaP
Try using the UIWebView+AFNetworking category's to call
loadRequest
.http://cocoadocs.org/docsets/AFNetworking/3.1.0/Categories/UIWebView+AFNetworking.html
Actually,
AFNetworking
andUIWebView
share the same cookies storage. So we don't need any special technique to letUIWebView
"share" a session initialized byAFNetworking
, or any native session-based request which usesNSHTTPCookieStorage
to store cookie. In my situation, theUIWebView
did not find shared session to be useful, just because the session initialized byAFNetworking
has lacked of a cookie which was sent only when browsing the site with a browser.And here is what I did to solve the problem:
Above code will ensure that we have all browser-specific cookies in NSHTTPCookieStorage, hence let the
UIWebView
share any session initialized by native login routine.