I am trying to do a simple app to open a deeplink to the Salesforce app, or redirect to the App Store if not installed.
I am launching the code from the View Controller but when trying to use SKStoreProductViewController it is telling me it is not in scope.
Any ideas on why this is the case?
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
guard let url = URL(string: "salesforce1://sObject/--------/view") else {
return
}
if UIApplication.shared.canOpenURL(url) {
// deep link to Einstein
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
else {
// app store if not installed
let vc = SKStoreProductViewController() //THROWS ERROR
}
}
}