Maybe I'm missing something, but from Apple's documentation for NSHTTPCookieStorage
, I can't help but wonder how this is safe to use.
Does this mean that cookie storage is shared across all apps on the iPhone? If my app makes an Http call that results in some cookies being saved, do all apps now have access to these cookies?
Methods like:
cookiesForURL: Returns all the receiver's cookies that will be sent to a specified URL.
make it look even more suspicious.
Can someone explain how this is OK, and what the class does?
Also, assuming my understanding is flawed and this is indeed sandboxed per-app, do calls made using NSURLRequest
automatically save/retrieve cookies from this store or is it the developers responsibility to set request headers before dispatching the request?
To check where are the app cookies stored on iPhone, On an iPhone, go to Settings -> Safari -> Advanced -> Website Data and you will see all cookies stored on your device. For iOS Application using web view The UIWebView will automatically store the cookies in the sharedHTTPCookieStorage.
SAFARI for iOS (iPhone and iPad)Step 1: Go to Settings, then scroll down and select “Safari”. Step 2: Scroll down to “Privacy & Security”. Step 3: Verify “Block All Cookies” is ticked (green/white), click to allow cookies. Step 4: Clear the browser cache and reopen the browser.
A container that manages the storage of cookies. iOS 2.0+ iPadOS 2.0+ macOS 10.2+ Mac Catalyst 13.1+ tvOS 9.0+ watchOS 2.0+
A WKWebView object is a platform-native view that you use to incorporate web content seamlessly into your app's UI. A web view supports a full web-browsing experience, and presents HTML, CSS, and JavaScript content alongside your app's native views.
Your application only has access to cookies within its own sandbox.
From http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/URLLoadingSystem/Concepts/URLOverview.html:
iPhone OS Note: Cookies are not shared by applications in iPhone OS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With