简体   繁体   English

使用Swift从Widget IOS打开应用程序

[英]Open App From Widget IOS with Swift

How I can open my App from the Today Widget with Swift ? 如何使用Swift从Today Widget打开我的应用程序? I just want to pressed the Widget and than i would like to open my App. 我只是想按下Widget,而不是想打开我的应用程序。 I got right now a button on my whole view the button is clear. 我现在在我的整个视图上都有一个按钮,按钮很清晰。 But that don't work for me:( I need Help:) 但那对我不起作用:(我需要帮助:)

@IBAction func launchApp(sender: AnyObject) {
   var url: NSURL = NSURL.URLWithString("AffordItLauncher://")
   self.extensionContext?.openURL(url, completionHandler: nil)
}

In your info.plist you need to add the following: 在info.plist中,您需要添加以下内容:

在此输入图像描述

And make sure that your app name is the same as the one in your url. 并确保您的应用名称与您的网址中的应用名称相同。 In your case, it should be AffordItLauncher 在你的情况下,它应该是AffordItLauncher

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Swift中主要应用的iOS 10 Open Today Widget - iOS 10 Open Today Widget from main App in Swift 从后台打开应用程序时,iOS Swift 3重新加载TableView - iOS swift 3 reload tableview when open app from background 使用我的ios App iOS 9 Swift 2.2中的路线打开Apple Maps应用程序 - Open Apple Maps App With Directions from my ios App iOS 9 Swift 2.2 在Swift中打开我的iOS应用程序的文档目录 - open documents directory of my iOS app in Swift 如何使用 swift 中的深度链接打开 iOS 应用程序 - How to open iOS app using deeplinking in swift iOS Swift:在收件箱电子邮件中打开邮件应用程序 - iOS Swift: Open Mail app in inbox emails 从应用程序快速打开图库 - Open gallery from app in swift 在Swift中的iOS应用中,如何打开Facebook应用到个人资料页面的特定部分 - From iOS app in Swift, how to open facebook app to specific section of profile's page Swift,Xcode,iOS-如何处理通过“在...中打开”从另一个应用程序发送到我自己的应用程序的文件 - Swift , Xcode, iOS - How to handle a file sent with 'Open in…' from another app to my own app 如何使用Swift从WebKit iOS应用中的tel:url链接打开电话 - How do I open phone from tel: url link from WebKit iOS app using Swift
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM