简体   繁体   English

如何从应用程序返回到今天的扩展

[英]How to return to today extension from app

When the user taps the today extension it opens the app where they can modify its settings. 当用户点击Today扩展程序时,它将打开该应用程序,他们可以在其中修改其设置。 But when the app is exited, the user is returned to the home screen. 但是当退出应用程序时,用户将返回到主屏幕。 Is there any way I return focus to the today extension so the user can view the changes immediately? 我有什么办法可以将焦点恢复到今天的扩展,以便用户可以立即查看更改? Or is this just not possible in iOS? 还是这在iOS中是不可能的?

I recommend making a button to go to the app. 我建议点击一个按钮以转到该应用程序。 Or add transition functionality after applying settings. 或在应用设置后添加过渡功能。

like this 像这样

 var instagramHooks = "instagram://user?username=johndoe"
var instagramUrl = NSURL(string: instagramHooks)
if UIApplication.sharedApplication().canOpenURL(instagramUrl!)
{  
    UIApplication.sharedApplication().openURL(instagramUrl!)

 } else {
    //redirect to safari because the user doesn't have Instagram
    UIApplication.sharedApplication().openURL(NSURL(string: "http://instagram.com/")!)
}

User can click on the top left button to return if the application has been opened from another application. 用户可以单击左上方的按钮以返回是否已从另一个应用程序打开了该应用程序。 You can update the data on his return. 您可以在他返回时更新数据。

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

相关问题 如何从应用程序中删除ios今天的扩展 - How to remove ios today extension from app 如何从Today扩展中更新应用 - How to update app from Today extension 如何将应用程序中的数据显示到 Today Extension Swift - How to show data from app to Today Extension Swift 如何从Swift的Today扩展中的父iPhone应用程序中调用方法? - How to call a method in the parent iPhone app from Today Extension in Swift? iOs - 如何使用url将数据从Widget(今日扩展)传递到App? - iOs - How to pass data from Widget (Today Extension) to App with url? 今日扩展(应用组) - Today Extension (App Groups) 如何使用Swift在我的应用程序的“今日扩展”中的Safari中打开url - How to open a url in Safari from my Today Extension within my app using Swift 如何从今天的扩展中设置 iOS 应用的徽章计数? - How can I set badge count of iOS app from its today extension? 如何使用主机应用程序中的数据更新iOS 10 Today小部件扩展? - How to update iOS 10 today widget extension with data from host app? 当主应用程序未打开时,Swift 如何从今天的扩展中打开特定的视图控制器 - Swift how to open specific viewcontroller from today extension when main app is not open
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM