打开“活动详情”在具有特定事件ID的日历应用中 [英] Open "Event Details" in calendar app with specific event id

查看:149
本文介绍了打开“活动详情”在具有特定事件ID的日历应用中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to open calendar with specific event, I have added events programmatically and all the IDs of these event are persistent.

这是我添加事件的方式

-(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

这里是我如何打开日历

-(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

任何想法?

推荐答案

要回答我自己的问题,这是不可能的任何公共API

我搜索了一年但是这对任何公共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).

日历应用程序的小部件正在做我想做的事情,但它的Apple的API不允许我们使用它。 lol

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

这篇关于打开“活动详情”在具有特定事件ID的日历应用中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆