SFSafariViewController on iOS 10 - not loading URL

When presenting SFSafariViewController, the view controller appears but does not seem to load the URL.

The same code, works as expected on iOS9.


if let myurl = NSURL(string: "http://www.apple.com") {

if #available(iOS 9.0, *) {

let sfVc = SFSafariViewController(URL: myurl)

vc.presentViewController(sfVc, animated:true, completion:nil)

}

}


Anyone encountered this?

I fixed this problem by changing my source as below.

[self presentViewController:safariViewController animated:YES completion:nil];

->

[[[[UIApplication sharedApplication] keyWindow] rootViewController] presentViewController:safariViewController

animated:YES

completion:nil];

it partially works for me but SFSafariViewController disappears seconds after being appeared on screen...

SFSafariViewController on iOS 10 - not loading URL
 
 
Q