简体   繁体   English

在具有特定活动ID的日历应用中打开“活动详情”

[英]Open “Event Details” in calendar app with specific event id

I am trying to open calendar with specific event, I have added events programmatically and all the IDs of these event are persistent. 我正在尝试使用特定事件打开日历,我已经以编程方式添加了事件,并且这些事件的所有ID都是持久的。

This is how i add event 这是我添加事件的方式

-(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];
    }];
}

The event is added successfully and i'm also able to open calendar app but the thing is i can't navigate inside the event detail in calendar 该事件已成功添加,我也可以打开日历应用程序但事情是我无法在日历中的事件详细信息中导航

here is how i open calendar 这是我打开日历的方式

-(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];
}

What i want is in below screenshot 我想要的是在下面的截图 在此输入图像描述

What i'm getting is 我得到的是 在此输入图像描述

any idea? 任何想法?

To answer my own question, this isn't possible with any of public API 要回答我自己的问题,任何公共API都无法做到这一点

I searched over a year but this is not possible with any public API, but i guess there might be some private API to do this (and probably doing that will get our app rejected). 我搜索了一年但这对任何公共API都不可能,但我想可能有一些私有API来做这个(并且可能这样做会让我们的应用程序被拒绝)。

Widget of calendar app is doing the same what i want to do but it's Apple's API wont allow us to use it. 日历应用程序的小部件正在做我想做的事情,但它的Apple的API不允许我们使用它。 lol 大声笑

I really don't think there's a way to do this. 我真的不认为有办法做到这一点。 Even when creating a new calendar event from the default Mail app opens the calendar day view. 即使从默认邮件应用程序创建新日历事件,也会打开日历日视图。 If this functionality was possible I'm sure they would have at least implemented it in the default mail app. 如果可以使用此功能,我相信他们至少会在默认邮件应用程序中实现它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM