How to get url from SFSafariViewController?

I integrate the login-api logic in iOS with Objective-C and I need to get the callback url.

I am currently using SFSafariViewController , but after logging in I can not read the URL. Is it possible to get the url from SFSafariViewController ?

+5
source share
1 answer

In SFSafariViewControllerDelegate , you only have one method that can help:

 optional public func safariViewController(controller: SFSafariViewController, didCompleteInitialLoad didLoadSuccessfully: Bool) 

But it will be called only on the initial (first) url file. If you redirect and wait for some url in auth mode, this will not help. Then you should use UIWebView and implement the UIWebViewDelegate delegation method:

 optional public func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool 

But don't forget to be ATS

+2
source

Source: https://habr.com/ru/post/1234611/


All Articles