Я устанавливаю расширение содержимого уведомлений в IOS и хотел бы добавить кнопку, которая открывает определенный вид в главном приложении.
Я могу сделать это с помощью кнопок действий (внизу)но хотел бы добавить кнопку в собственное представление.
@ IBAction func btn_openapp (_ sender: Any) {
let mystring = "mydrop://" + String(campaign_id)
self.extensionContext?.open(URL(string: mystring)!, completionHandler: nil)
}
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool
{
d_me["single"] = url.host
print(url.host,url.scheme)
if url.scheme == "mydrop://"
{
let rootViewController = self.window!.rootViewController as! UINavigationController
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let targerView = mainStoryboard.instantiateViewController(withIdentifier: "CampaignDetailViewController")
rootViewController.pushViewController(targerView, animated: false)
}
return true
}