ios - 在具有特定事件 ID 的日历应用程序中打开 "Event Details"

标签 ios objective-c iphone ekeventkit

我正在尝试打开带有特定事件的日历,我以编程方式添加了事件,并且这些事件的所有 ID 都是持久的。

这是我添加事件的方式

-(IBAction)addEvent:(id)sender{
    EKEventStore *store = [[EKEventStore alloc]init];
    [store requestAccessToEntityType:EKEntityTypeReminder completion:^(BOOL granted, NSError *error) {
        if (!granted) { return; }
        EKEvent *event = [EKEvent eventWithEventStore:store];
        event.title = @"Demo Title";
        NSDateComponents *comps=[[NSDateComponents alloc]init];
        [comps setDay:4];
        [comps setMonth:10];
        [comps setYear:2016];
        [comps setHour:12];
        [comps setMinute:1];

        NSDate *date=[[[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierGregorian] dateFromComponents:comps];
        _date=date;
        event.startDate = date;
        event.endDate=date;
        event.notes=@"This is event description";

        EKAlarm *alarm=[EKAlarm alarmWithAbsoluteDate:date];
        [event addAlarm:alarm];
        event.calendar = [store defaultCalendarForNewEvents];

        NSError *err=nil;
        [store saveEvent:event span:EKSpanThisEvent commit:YES error:&err];
    }];
}

事件已成功添加,我也可以打开日历应用程序,但问题是我无法在日历中的事件详细信息中导航

这是我打开日历的方式

-(IBAction)openCalender:(id)sender{
    NSInteger interval = [_date timeIntervalSinceReferenceDate];
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"calshow:%ld?eventid=%@", (long)interval,_eventID]];
    NSLog(@"%@",url);
    [[UIApplication sharedApplication] openURL:url];
}

我想要的是下面的截图 enter image description here

我得到的是 enter image description here

有什么想法吗?

最佳答案

回答我自己的问题,这对任何公共(public) API 都是不可能的

我搜索了一年多,但这对任何公共(public) API 都是不可能的,但我想可能有一些私有(private) API 可以执行此操作(并且可能这样做会使我们的应用程序被拒绝)。

日历应用程序的小部件与我想做的一样,但 Apple 的 API 不允许我们使用它。哈哈

关于ios - 在具有特定事件 ID 的日历应用程序中打开 "Event Details",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39846024/

相关文章:

iphone - Redis 对比iOS 应用程序中推送通知的 Web 服务

objective-c - 应用程序不再在设备上运行......吓坏了

ios - 从一个 View Controller 传递字符串并将其显示在 ios 的 UITextView 中

ios - 如何在 TableView 中的可变数组中存储多个选定的行项

objective-c - 向 ABPerson 添加可导出属性的任何方法

iphone - 在 iPhone 上获取距离矩阵 API (google) 的 XML

iphone - Xcode:iPhone 屏幕截图不再有效

ios - 如何调整导航栏中按钮的垂直位置?

ios - 单元格在滚动后丢失 gradientLayer

iphone - 如何创建一个可以水平滚动的UITableView?