使用iOS 9,NSUserActivities可以和Siri一起使用,例如," Siri,在一小时内提醒我这一点",在她知道" THIS&#的背景下创建提醒34;是。有没有办法以编程方式执行此操作,因此单击按钮可以创建提醒?
答案 0 :(得分:1)
您可以简单地安排一个提醒用户的UILocalNotification:
NSDate *dateInOneHour = [[NSDate date] dateByAddingTimeInterval:3600];
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = dateInOneHour;
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody = @"Don't forget about THIS";
localNotif.alertAction = @"View";
localNotif.applicationIconBadgeNumber = 1;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];