Is it possible to interact with iOS 5's Reminders app from my app?

前端 未结 5 1021
夕颜
夕颜 2021-01-02 06:05

Is there a way to add, read, or delete reminder items from the new iOS 5 built-in Reminders app?

5条回答
  •  清酒与你
    2021-01-02 07:10

    I'd really like access to the reminders too, I found a post explaninf adding events to the calendar here ..

    Programmatically add custom event in the iPhone Calendar

    While the Calendar is "ok" for reminders, it makes more sence to use the IOS 5 "Reminders" app, after all SIRI can use it! :p

    EDIT: I solved my problem by using Local Notifications....

    UILocalNotification *localNotif = [[UILocalNotification alloc] init];
    if (localNotif == nil)
        return nil;
    localNotif.fireDate = itemDate;
    localNotif.timeZone = [NSTimeZone defaultTimeZone];
    
    // Notification details
    localNotif.alertBody = @"Here is your alert!";
    
    // Set the action button title
    localNotif.alertAction = @"View";
    
    //localNotif.soundName = UILocalNotificationDefaultSoundName;
    localNotif.soundName = @"Bell.aiff";
    localNotif.applicationIconBadgeNumber = 1;
    
    // Specify custom data for the notification
    NSDictionary *infoDict = [NSDictionary dictionaryWithObject:myCustomMessage.text forKey:@"message"];
    localNotif.userInfo = infoDict;
    
    // Schedule the notification
    [[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
    

    This allows me to set notifications which appear like Push Notifications and they are preserved even when the app is restarted.

    You can clear them if needed with ..

    [[UIApplication sharedApplication] cancelAllLocalNotifications];
    

    Plasma

提交回复
热议问题