AlarmManager的iOS替代品

AlarmManager的iOS替代品

本文介绍了适用于Android AlarmManager的iOS替代品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是iOS Swift 2替代Android AlarmManager.

What is iOS Swift 2 alternative to Android AlarmManager.

到目前为止,我发现关闭的东西是NSTimer.但这仅在您的应用程序启动后才起作用,一旦进入后台就将无法运行,并且我需要在后台以及从业务逻辑中运行某些功能来决定是否要执行某项操作...例如,如果满足某些条件以显示本地通知.

So far the closes thing that I found is NSTimer. But that works only when your application is up, once it goes to the background it won't work, and I need to run some function in the background and from my business logic to decide if I want to do something or not...for example if some condition is satisfied to display local notification.

编辑

对于那些有相同问题的人,简单的答案就没有在iOS上那样.

For these who have the same question, simple answer there's nothing like that on iOS.

唯一的解决方法是仅使用远程推送通知(静默通知)来唤醒应用程序,然后您就可以实施业务逻辑.

*重要提示

根据我在几个地方发现的信息,人们抱怨使用静默通知来执行此操作,因为您的应用程序可能会在应用商店中被拒绝.

From what I have found on few places is that people are complaining about using silent notifications to do this because your application might be rejected on app store.

如果在应用商店中有人在使用这种方法处理他的应用,请分享您的经验.

If there's anyone there who is using this approach for his app on app store please share your experience.

推荐答案

没有.

如评论中所述,文档化在这一点上很清楚:

As already stated in the comments, the documenation is quite clear on that:

,但以下情况除外:

  • 在后台播放用户可听内容的应用,例如音乐播放器应用

  • Apps that play audible content to the user while in the background, such as a music player app

在后台录制音频内容的应用

Apps that record audio content while in the background

始终使用户了解其位置的应用程序,例如导航应用程序

Apps that keep users informed of their location at all times, such as a navigation app

支持互联网协议语音(VoIP)的应用

Apps that support Voice over Internet Protocol (VoIP)

需要定期下载和处理新内容的应用

Apps that need to download and process new content regularly

从外部附件接收定期更新的应用

Apps that receive regular updates from external accessories

这篇关于适用于Android AlarmManager的iOS替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 18:23