Use hidden SFSafariViewController to get Safari co

2019-04-09 21:25发布

问题:

I was reading the following post on authenticating users from mobile web pages to native iOS 9 apps and was wondering how to best implement a hidden safari view controller similar to the hidden controller talked about below?

https://library.launchkit.io/how-ios-9-s-safari-view-controller-could-completely-change-your-app-s-onboarding-experience-2bcf2305137f#.r810oldla

回答1:

Don't use this approach if you're going to distribute your app to the AppStore, because according to updated App Store Review Guidelines:

5.1.1:

(iv)SafariViewContoller must be used to visibly present information to users; the controller may not be hidden or obscured by other views or layers. Additionally, an app may not use SafariViewController to track users without their knowledge and consent.



回答2:

This has changed in iOS 11. Going forward, every app (including Safari itself) will have a completely sandboxed data store. Official announcement here (at the 17:28 mark).

Long live the invisible SFSafariViewController. iOS 9 to iOS 10.

If you need a way to pass a guaranteed user match through from Safari to your app, you'll need to use an existing network of device matches, such as Branch.io (full disclosure: I'm on the Branch team). You can read about the techniques Branch uses instead of cookie passthrough here.



回答3:

You can give the sample code here a try: https://github.com/mackuba/SafariAutoLoginTest