3
votes

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 outside of the main ios app. I have made sure app groups are set up correctly and the identifier is the same. I have logged the cookies when exiting the app, it says they are there but logging them when opening extensions shows they are for the extensions.

Has anyone had a similar experience?

Thanks for any help!

1

1 Answers

2
votes

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