在iOS应用程序中打开Reminder应用程序?

时间:2014-04-08 05:52:12

标签: ios ios7

是否可以在我开发的App中使用iOS Reminder Built in Application? 我不想使用OPEN URL概念,因为它会退出我的应用程序一个开放的提醒应用程序? 我可以取悦iOS SDk发布的任何自定义提醒应用程序,它将创建提醒 在iOS的提醒应用程序

1 个答案:

答案 0 :(得分:1)

有一个提醒API,可让您创建和检索提醒。

首先,您需要获得用户许可才能执行此操作:

EKEventStore *store = [[EKEventStore alloc] initWithAccessToEntityTypes:EKEntityMaskReminder];
[store requestAccessToEntityType:EKEntityTypeReminder completion:^(BOOL granted, NSError *error) {
    if (granted) {
        [self createReminder:store];
    }
    else {
        // :(
    }
}];

要创建提醒,您可以:

- (void)createReminder:(EKEventStore *)store {
    //Create a reminder instance
    EKReminder *aReminder = [EKReminder reminderWithEventStore:store];

    // Set the properties
    aReminder.title = @"Remember to do X";
    ...

    // Then save the reminder to the store
    NSError *error = nil;
    [store saveReminder:aReminder commit:YES error:&error];

    // Be responsible
    if (error) {
        [self rememberToHandleYourErrors:error];
    }
}
相关问题