NSHTTPCookieStorage Vs keychain vs NSUserdefault
NSUserDefault
, the data stored in it will remain the same as before the application. Once you uninstall the app, everything is lost. Not fully secured.
Keychain
, the data stored in it will remain the same as the user reset for all phone settings. See the link for details along with its implementation. If the user backs up this iPhone and saves any other phone, all data will be available to that device. Also, all data is stored securely and in an encrypted format.
NSHTTPCookieStorage
implements a singleton object (shared instance) that manages the storage of cookies. Each cookie is represented by an instance of the NSHTTPCookie class. Typically, cookies are shared across all applications and are kept in sync across process boundaries. Session cookies (where cookies are the SessionOnly method returns YEStrue) are local to the same process and are not shared.
If you want to store the token in the application, as well as in the Safari browser or in any other application, then this NSHTTPCookieStorage
is the best option for you.
source to share