![](/img/trans.png)
[英]Google Calendar Event Link not opening Google Calendar App Event Creation with Details
[英]Open “Event Details” in calendar app with specific event id
我正在嘗試使用特定事件打開日歷,我已經以編程方式添加了事件,並且這些事件的所有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];
}
任何想法?
要回答我自己的問題,任何公共API都無法做到這一點
我搜索了一年但這對任何公共API都不可能,但我想可能有一些私有API來做這個(並且可能這樣做會讓我們的應用程序被拒絕)。
日歷應用程序的小部件正在做我想做的事情,但它的Apple的API不允許我們使用它。 大聲笑
我真的不認為有辦法做到這一點。 即使從默認郵件應用程序創建新日歷事件,也會打開日歷日視圖。 如果可以使用此功能,我相信他們至少會在默認郵件應用程序中實現它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.