我怎样才能实现Apple的“Snooze”时钟应用中的功能? [英] How can I implement Apple's "Snooze" functionality in their Clock app?

查看:173
本文介绍了我怎样才能实现Apple的“Snooze”时钟应用中的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在深入开发iOS,正在构建自己的闹钟应用程序,以熟悉平台和SDK。我目前正在学习的其中一个API是Local Notifications API,我认为它与Apple在Clock应用程序中用于实现警报的API相同。

I'm diving into iOS development and am building my own alarm clock app to become familiar with the platform and SDK. One of the API's I'm currently learning is the Local Notifications API, which I assume is the same API Apple uses to implement their alarms in their Clock app.

我不明白他们是如何实现贪睡功能的。据我了解,本地通知允许您向用户显示一个警报框,当您的应用程序未在前台运行时,该警告框最多有两个按钮,一个按钮用于解除警报,一个按钮用于将用户带到您的应用程序。然而,在Apple的Clock应用程序中,用户会看到一个带有两个按钮的警告框,一个用于关闭警报的按钮和一个用于暂停的按钮,并在不启动Clock应用程序的情况下重新安排警报。我的问题是...

What I don't understand is how they implement their "Snooze" functionality. As I understand it, Local Notifications allow you to present to the user an alert box that has at most two buttons when your app isn't running in the foreground, one button for dismissing the alert and one button for taking the user to your app. In Apple's Clock app, however, it appears the user is presented with an alert box with two buttons, one button to dismiss the alarm and one button to "Snooze" and reschedule the alarm without launching the Clock app. My questions are...


  1. 当用户点击暂停按钮时,您认为Apple如何重新安排本地化没有启动Clock应用程序的闹钟通知?您是否认为他们使用自己的私有API来规避本地通知的限制,只允许两种选择?或者你认为他们正在启动时钟应用程序以重新安排本地通知,他们只是不显示应用程序启动和退出?

  1. When the user clicks the "Snooze" button, how do you think Apple is rescheduling the Local Notification for the alarm without launching the Clock app? Do you think they're using their own private APIs that circumvent the limitations of the Local Notifications that only allow for two options? Or do you think they're launching the Clock app to reschedule the Local Notification, they just don't show the app launching and quitting?

文档说本地通知的alertAction属性是警告框右侧按钮和锁定屏幕滑块上显示的文本。但是,在Apple的Clock应用程序中,Snooze文本是警告框中的左键,也不是Slider栏文本。为什么倒退呢?

The documentation says the "alertAction" property of the Local Notification is the text to be displayed on the right button of the alert box and the slider bar of the lock screen. In Apple's Clock app, however, the "Snooze" text is the left button in the alert box, nor is it the Slider bar text. Why is this backwards?

非常感谢您的想法!

推荐答案

本地通知API没有任何机制可以执行您想要的操作。闹钟应用程序几乎肯定不会使用任何基础设施进行本地通知,它早于它们。即使它被考虑到本地通知提供的某些基础设施,也肯定不会使用公共API。

The local notification API does not have any mechanism to do what you want. The alarm clock app is almost certainly not using any of the infrastructure for local notifications, it predates them. Even if it is factored onto some of the infrastructure provided by local notifications, it is certainly not using the public APIs.

你应该 file 一个错误,要求添加此功能。

You should file a bug requesting that this functionality be added.

这篇关于我怎样才能实现Apple的“Snooze”时钟应用中的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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