简体   繁体   English

Xamarin iOS 后台应用程序终止

[英]Xamarin iOS backgrounding app termination

I'm currently developing a timer app for android and iOS.我目前正在为 android 和 iOS 开发一个计时器应用程序。 I really care more about iOS for the time being, and even after following Xamarin's documentation on backgrounding, using messaging center calls to the appDelegate.cs class and then launching a background task with the platform specific code, I'm still having my app terminated.暂时我真的更关心 iOS,即使在遵循 Xamarin 关于后台的文档,使用消息中心调用 appDelegate.cs 类,然后使用特定于平台的代码启动后台任务后,我的应用程序仍然终止.

Is there any way to put an iOS app as a foreground service, like on android.有什么方法可以将 iOS 应用程序作为前台服务,例如在 android 上。 Or is a background service still the way to go?或者后台服务仍然是要走的路? I am trying to allow the user to set a timer up to 23 hours in advance and show count down.我试图允许用户提前 23 小时设置计时器并显示倒计时。

To those interested, another strategy I found was just setting a notification to go off, regardless of if the app is running or not.对于那些感兴趣的人,我发现的另一个策略是设置一个通知来关闭,无论应用程序是否正在运行。 Then, you can just handle persistence instead of trying to make the app keep running!然后,您可以只处理持久性而不是试图让应用程序继续运行!

Good luck to everyone!祝大家好运!

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

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