How I can open native alarm clock in iphone by using code?

前端 未结 3 2060
迷失自我
迷失自我 2021-01-05 15:55

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?

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-05 16:59

    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.

    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.

提交回复
热议问题