我一直致力于IOS闹钟应用。我将在应用程序中创建一个警报。所以我需要闹钟才能工作,因为"时钟"应用程序在IOS中工作。
当闹钟时间到来且应用未运行时。警报声将播放,用户可以通过单击取消或暂停来停止它。
答案 0 :(得分:2)
对于您需要使用的警报UILocalNotification
您可以使用以下应用程序设置警报计划:
- (void)scheduleLocalNotificationWithDate:(NSDate *)fireDate {
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
[localNotification setFireDate:fireDate];
[localNotification setAlertBody:@"Time to wake up!"];
[localNotification setSoundName:@"Thunder Song.m4r"];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
}
以下是两个Github
链接,例如代码或闹钟,但UILocalNotification没有任何设置暂停的方法: