简体   繁体   中英

How to share NSHTTPCookieStorage in iOS 8 Extension?

I am working on an app that uses NSHTTPCookieStorage to store user data. I can't get to access the cookies inside the extension, as are saved inside Library. Thank you.

Cookies are not intended to be shared between applications (see NSHTTPCookieStorage ).

Do you know which cookies in particular you are looking for? If you have a way of identifying the ones you want, you could copy them yourself to keychain or a shared CoreData store.

This way both your app and extension will have access to them.

Using NSHTTPCookieStorage is not a preferred way of storing user data. If you aim for simplicity and don't want CoreData or Keychain you could just use a plist. This also allows you to use NSFileProtectionComplete to provide a layer of security to the data you are storing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM