简体   繁体   English

如何在一天中的特定时间在Swift iOS中启动我的应用

[英]how to start my App in a particular time of the Day in Swift iOS

I have an App built on Swift, I want this App to start every day at some particular time. 我有一个基于Swift的应用程序,我希望该应用程序每天在特定时间启动。 Logically its like Calendar notification, which gives notification in that particular window whatever we set. 从逻辑上讲,它类似于日历通知,无论设置什么,它都会在该特定窗口中提供通知。

Does is the same scenario is possible with an App in iOS Swift. 使用iOS Swift中的应用程序确实可以实现相同的方案。

What you can probably do is to create a local notification, but this is not opening your app. 您可能可以做的是创建本地通知,但这不会打开您的应用程序。 A local notification is just a way to show a notification on your iPhone and then, if the user taps, it's opening your app. 本地通知只是在iPhone上显示通知的一种方式,然后,如果用户点击,它将打开您的应用程序。

See more here: https://www.codebeaulieu.com/49/How-to-add-local-notifications-to-your-app 在此处查看更多信息: https : //www.codebeaulieu.com/49/How-to-add-local-notifications-to-your-app

I am not sure what you want to do, you cannot force your application upon the user without the user's consent. 我不确定您要做什么,未经用户同意,您无法将应用程序强加给用户。 What you can do is schedule a local notification so the user knows when to open your app like jomafer proposed already. 您可以做的是安排本地通知,以便用户知道何时打开您的应用程序,就像jomafer已经建议的那样。 Also possible is to wake up the app to do stuff in the background: 也可以唤醒应用程序在后台执行操作:

https://developer.apple.com/library/prerelease/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html https://developer.apple.com/library/prerelease/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html

For example a silent push notification that will trigger some code, or a scheduled background download. 例如,将触发某些代码的无声推送通知或计划的后台下载。

NONE OF THESE METHODS ARE 100% RELIABLE THOUGH! 这些方法都不是100%可靠的方法!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM