So I'm using SFSafariController to load up an URL downloaded from cloudkit, like so.
if let yelpurl = detail.value(forKey: "Yelp") as? String
{
let url = URL(string: (yelpurl))
let safari = SFSafariViewController(url: url!, entersReaderIfAvailable: false)
safari.delegate = self as? SFSafariViewControllerDelegate
self.present(safari, animated: true, completion: {
})
} else {
}
}
The code itself is fine - no errors, pulls up the yelp page URL and loads it up in an SFSafariController in simulator, but on my device, I am left with a white blank screen. What is causing this disparity and how can I correct this on device?
To add, the plist still stands without any modification.
Edit 1:
I created a new project to purely test the below mentioned code to possibly discover a new error. This is what I found - and wondering how to solve.
Update: I updated to 10.3.3 and deleted my browsing history.
Just created a sample project and it works on both simulator and iPhone 6S iOS 10.3.2, code:
import UIKit
import SafariServices
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let deadlineTime = DispatchTime.now() + .seconds(1)
DispatchQueue.main.asyncAfter(deadline: deadlineTime) {
self.showLinksClicked()
}
}
func showLinksClicked() {
let yelpurl = "https://google.com"
let url = URL(string: (yelpurl))
let safari = SFSafariViewController(url: url!, entersReaderIfAvailable: false)
safari.delegate = self as? SFSafariViewControllerDelegate
self.present(safari, animated: true, completion: {
})
}
}
So looks like something is wrong with your URL or with way you call the method to present safari. Put your code to a separate method and be sure that you pass right URL.