I want to close SFSafariViewController automatically upon reaching the "thank you" page of the Dropbox site after the user uploads something; it needs to automatically dismiss. How can I do that?
Here is what I have so far:
@IBAction func Singles5(_ sender: Any) {
let safariVC = SFSafariViewController(url: NSURL(string: "https://www.dropbox/Upload")! as URL)
self.present(safariVC, animated: true, completion: nil)
safariVC.delegate = self
}
One way I can think of is using the Custom URL scheme. You can specify your app's custom URL in the callback parameter of Dropbox (if Dropbox has callback). So when the user has finished uploading his/her file, dropbox executes the callback. In this case your app will receive the callback, with any parameters have you specified. This will call the function application(app, open, options)->Bool
in your AppDelegate
. Now, you can use a reference to the ViewController which presents the SFSafariViewController
and call SafariViewController.dissmissViewController()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With