1

With iOS 9, NSUserActivities can be used with Siri, for example, "Siri, remind me of this in an hour", creates the reminder with her knowing the context of what "THIS" is. Is there a way to programmatically do that, so at the click of a button you could create a reminder?

user717452
  • 33
  • 14
  • 73
  • 149

2 Answers2

1

You could simply schedule a UILocalNotification that will remind the user:

 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];  
Zigglzworth
  • 6,645
  • 9
  • 68
  • 107
  • Thanks for that suggestion, I do have that in there, but it just fires off the local notification. I was looking for an option that would add it in the official Reminders app, the way Siri Contextual Search does...I just can't use that, in a tableview, as she wouldn't know which one needed to be reminded of. – user717452 Sep 29 '15 at 14:53
  • What does Siri have to do with anything? If your question is "How do I programmatically add a reminder to the reminder app" then you ask "How do I programmatically add a reminder to the reminder app". Anyway see - http://stackoverflow.com/questions/15864595/programatically-add-a-reminder-to-the-reminders-app – Zigglzworth Sep 29 '15 at 15:40
  • I believe I did do that. "Is there a way to programmatically do that, so at the click of a button you could create a reminder?" That's straight out of the OP – user717452 Sep 29 '15 at 15:43
0

Not an answer as such, but a path to one: since reminders a la the Reminders app are managed by EventKit (see https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/EventKitProgGuide/Introduction/Introduction.html), try making a Smart Reminder using Siri, then examine the resulting reminder using the API. At a guess, it's using the -URL property on the reminder.

Chris N
  • 905
  • 5
  • 10