如何使用代码在iphone中打开本机闹钟? [英] How I can open native alarm clock in iphone by using code?

查看:160
本文介绍了如何使用代码在iphone中打开本机闹钟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须创建一个示例应用程序,当我点击一个应该打开本机闹钟的按钮,以便用户可以使用它来设置闹钟?

I have to crate a sample app in which when I clicked a button that should open the native alarm clock so that user can use it for setting alarm?

推荐答案

如果Clock应用程序支持URL方案,例如电话应用程序的 tel:// 或邮件应用程序的邮件:// ,您可以使用标准 [[UIApplication sharedApplication] openURL打开它:[NSURL URLWithString:@...]] 做法。不幸的是,据我所知,它没有,所以你真正做的就是提示用户自己打开那个应用来设置闹钟。

If the Clock app supported a URL scheme, like the Phone app’s tel:// or the Mail app’s mail://, you could open it with the standard [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"..."]] approach. Unfortunately, to my knowledge, it doesn’t, so all you can really do is prompt the user to open that app themselves to set up the alarm.

或者,你可以让您的应用使用UILocalNotification设置本地通知 act 作为闹钟,您可以通过搜索此网站

Alternatively, you can have your app set up a local notification to act as an alarm using UILocalNotification, which you can find plenty of information about by searching this site.

这篇关于如何使用代码在iphone中打开本机闹钟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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