SafariViewController does not store cookies across sessions in iOS 11 Beta 3

Originator:buchanan.paul
Number:rdar://33323462 Date Originated:
Status:Duplicate of 33221110 (Open) Resolved:
Product:iOS SDK Product Version:iOS 11 Beta 3
Classification:Safari Services Reproducible:Always
 
I'm aware of the changes to SafariViewController announced at WWDC.  From the "What's New in Safari View Controller" talk about 17 minutes in:

https://developer.apple.com/videos/play/wwdc2017/225

" Now I'd like to talk about some privacy improvements on iOS 11 in Safari View Controller.  Browsing the web in your app is different than browsing the web in other apps.  It's different than browsing the web in Safari. I sometimes want to use different accounts when browsing the web in different apps. For some apps, I'll use my work account and for other apps I'll use my personal account. On iOS 11, Safari View Controller will have a separate persistent data store in each app that it's used in.  This means that cookies, local storage, and other browsing data will be contained within your app and scoped to your app."

So, the way I interpret that, is that each app has its own cookie store.  A cookie stored in one SafariViewController session should be available in the next one as long as you are in the same application.  That doesn't appear to be happening.  Cookies set in one session, are not being made available in the next session for a given app.

Steps to Reproduce:
Xcode 8.3.3 
1) Run the attached sample app on Xcode 8.3.3, using an iOS 10.x simulator or device
2) Tap the 'Launch SafariViewController' button
3) developer.apple.com/downloads is opened, prompting a login
4) Log in with credentials
5) Tap the done button to close the SafariViewController
6) Tap the 'Launch SafariViewController' button a second time
7) Observe that you are still logged in due to the cookie that was set in the prior session

Now compare with Xcode 9 beta 3
1) Run the attached sample app on Xcode 9 beta 3, using an iOS 11 simulator or device
2) Tap the 'Launch SafariViewController' button
3) developer.apple.com/downloads is opened, prompting a login
4) Log in with credentials
5) Tap the done button to close the SafariViewController
6) Tap the 'Launch SafariViewController' button a second time
7) Observe that you are _not_ logged in, and are prompted with the login screen

This not staying logged in behavior affects all web services that I have tried, such as Twitter etc.

Expected Results:
Expectation is that because we are in the same application, and are just launching separate SafariViewController instances, that the login cookie from the first session is made available to the second session

Observed Results:
Each SafariViewController instance seems to have its own set of cookies, even within the same app

Version:
iOS 11 beta 3,  Xcode 9 beta 3

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!