【发布时间】:2015-06-26 22:08:56
【问题描述】:
我想在我的 To-DO 列表 View Controller 应用程序中添加一个提醒日历,因为用户可以添加日期和时间,并在它出现时从通知中心获得通知。我希望你能帮忙! 先感谢您!
【问题讨论】:
标签: xcode calendar notifications push-notification reminders
我想在我的 To-DO 列表 View Controller 应用程序中添加一个提醒日历,因为用户可以添加日期和时间,并在它出现时从通知中心获得通知。我希望你能帮忙! 先感谢您!
【问题讨论】:
标签: xcode calendar notifications push-notification reminders
最好的方法是制作一个单独的“应用扩展”,作为小部件位于通知中心并与您的应用进行通信。
否则你会有本地通知:
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
[localNotification setRepeatInterval:NSWeekCalendarUnit];
[localNotification setFireDate:[date dateByAddingTimeInterval:interval]];
[localNotification setTimeZone:[NSTimeZone defaultTimeZone]];
[localNotification setSoundName:sound];
[localNotification setAlertBody:WAKE_UP_TEXT];
[localNotification setAlertAction:@"Open"];
[localNotification setHasAction:YES];
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:[uidOfObject copy] forKey:@"myNotificationID"];
localNotification.userInfo = userInfo;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
【讨论】: