如何快速创建一个闹钟应用程序? [英] How to create an alarm clock app with swift?

查看:203
本文介绍了如何快速创建一个闹钟应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试快速创建一种闹钟应用,但我不知道如何设置闹钟模型。我已经尝试过 UILocalnotification ,但是我不想让我的用户参与警报应用程序的流程,而只是设置警报。然后尝试了 NSTimer NSRunloop 等。但这都不起作用,因为当应用程序获得背景时它们不起作用。那么有没有其他方法可以做到这一点?谢谢您的任何帮助和建议。

I'm trying to create a kind of alarm clock app with the swift but I could not figure out how to set an alarm model. I've tried UILocalnotification but I don't want my users to be involved the flow of alarm app other than setting the alarm. Then tried NSTimer and NSRunloop etc. but that didn't work either since those don't work when app gets background. So is there any alternative ways to do that? Any help and suggestion would be appreciated, thanks.

推荐答案

我已经对此进行了一段时间的研究。但是没有找到任何具体的方法。您必须使用列表中的以下内容之一,并做出逻辑以使应用程序从后台唤醒。

I have been doing research on this for quite some time now. But didn't find any concrete way to do it. You have to use one of the following from the list and make a logic to awake the app from the background.

对于警报,您可以浏览博客此处。它具有详细信息,您可以用来与info.plist文件中的 UIApplicationExitsOnSuspend 进行逻辑关联。

For the alarm you can go through the blog here. It's having the details, which you can use to make a logic with UIApplicationExitsOnSuspend in info.plist file.

这篇关于如何快速创建一个闹钟应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆