sharedCookieStorageForGroupContainerIdentifier: Not working

NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedCookieStorageForGroupContainerIdentifier:identifier]; Not working between Extensions and core app


Has Anyone been using App groups and the shared Cookie Storage to handle all the cookies between the App, Extensions, or watch. I am saving all of my cookies to this shared cookie storage but when I open an extension and check the cookies they are not there. I have set urlsession and everywhere possible to use this cookie storage but they are not persisting.


Has anyone had a similar experience?


Thanks for any help!

I haven’t tried this myself, but I do a have a suggestion. The first thing I do when debugging problems like this is double check that App Groups are working in general. You can do that as follows:

  1. in your app, get the group container URL

  2. write a file to the group (containing the current date, say)

  3. in your extension, get the group container URL

  4. read the file from the group

Or, if it’s more convenient, vice versa.

If this fails then you have App Group problems. If it works, you know the problem is specific to shared cookie stores.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks For the reply eskimo,



The problem was with the actual cookies themseleves. It seems the storage was only storing the non session cookies(ones with expiration dates) to the cookies.binarycookies file. The rest were just in memory on the app and not getting carried over. I added exp dates to the cookies and manually delete those ones later on

sharedCookieStorageForGroupContainerIdentifier: Not working
 
 
Q