Access iPhone alarm from app?

可紊 提交于 2019-12-14 03:53:55

问题


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?


回答1:


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.

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

From the Apple Docs,

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.



来源:https://stackoverflow.com/questions/29860001/access-iphone-alarm-from-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!