Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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 enter image description here

What i'm getting is enter image description here

any idea?

like image 836
Pratik Jamariya Avatar asked Oct 04 '16 06:10

Pratik Jamariya


1 Answers

To answer my own question, this isn't possible with any of public 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).

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. lol

like image 153
Pratik Jamariya Avatar answered Oct 13 '22 00:10

Pratik Jamariya