从应用程序访问iPhone闹钟? [英] Access iPhone alarm from app?

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

问题描述

有没有办法从我的应用程序访问和更新iPhone中的本机警报设置?我需要根据一年中的时间改变滑动警报,我想使用本机iPhone警报。这可能在iOS SDK中,也可能要求用户访问警报,例如当您的应用需要访问相机或照片时?

Is there a way to access and update the native alarm settings in the iPhone from my app? I need to have a sliding alarm that changes based on the time of year and I want to use the native iPhone alarm for that. Is this possible in the iOS SDK, maybe asking the user for access to the alarm like when your app needs access to the camera or photos for example?

推荐答案

不幸的是,我认为没有用于访问时钟应用和设置的公共API。我认为这样做的原因是Apple希望将Clock的独特背景行为限制在其原生应用程序中。

Unfortunately, I believe there is no public API for accessing the Clock app and settings. I think the reason for this is that Apple wants to restrict Clock's unique background behavior to its native app.

另一种方法是使用 UILocalNotifications 来启动闹钟。

An alternative would be to use UILocalNotifications to set off the alarm.

来自 Apple Docs


本地通知非常适合具有基于时间的
行为的应用,例如日历和待办事项列表应用程序。在iOS允许的有限时间内以
为背景运行的应用也可能会发现本地
通知有用。

Local notifications are ideally suited for apps with time-based behaviors, such as calendar and to-do list apps. Apps that run in the background for the limited period allowed by iOS might also find local notifications useful.

这篇关于从应用程序访问iPhone闹钟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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