Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 999
Alexandru Dranca Avatar asked Jan 28 '15 09:01

Alexandru Dranca


1 Answers

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.

like image 171
kkodev Avatar answered Nov 08 '22 17:11

kkodev