0

We have an application where we use UIWebView to display HTML content. Some HTML content is restricted to so user need to pass the authentication process using webservice. Once user is authenticated, the cookies stored in app and UIWebView is used it for future reference.

The HTML content has links with same and different domain. When user tap on link, app opens in-app browser so user won't distract from it's original article. We don't have control over embedded links so links can be HTTP or HTTPS. So we decided to use SFSafariViewController so HTTP and HTTPS links could open.

The user is already authenticated and can access content in UIWebView. Now the issue is, SFSafariViewController doesn't use the app cookies and ask user to authenticate again.

Any solution to solve this issue? Thanks in advance.

wottle
  • 13,095
  • 4
  • 27
  • 68
miOS
  • 1,379
  • 13
  • 20
  • Any reason why you use a UIWebView for the initial display of the web content? I do not believe there is any way to share cookies with SFSafariViewControllers / Safari. Apple created SFSafariController to solve this problem, so I would recommend using it to replace all your webviews. – wottle Nov 30 '16 at 22:42
  • Thanks for response. Using UIWebView because we need to present different view controllers when user tap on image or PDF links. So need to use callback method shouldStartLoadWithRequest which is not available in SFSafariViewController. Also app has offline reading functionality which SFSafariViewController doesn't support. – miOS Dec 01 '16 at 04:23
  • Unfortunately, due to security reasons, I don't think there's any way to share that across the two. You could use ATS exceptions for WebContent, but I've seen people having problems with that. Also, you'd need to have your justification ready starting 1/1/2017 as Apple will be requiring justification for using those exceptions for apps submitted after that date. – wottle Dec 01 '16 at 13:05

0 Answers0