2016-10-04 20 views
7

Tôi đang cố gắng mở lịch với sự kiện cụ thể, tôi đã thêm các sự kiện theo chương trình và tất cả ID của sự kiện này đều liên tục.Mở "Chi tiết sự kiện" trong ứng dụng lịch có id sự kiện cụ thể

Đây là cách tôi thêm sự kiện

-(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; 
     [email protected]"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]; 
    }]; 
} 

Sự kiện này được thêm thành công và tôi cũng là có thể mở ứng dụng lịch nhưng vấn đề là tôi không thể di chuyển bên trong các chi tiết sự kiện trong lịch

ở đây là làm thế nào tôi mở lịch

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

gì tôi muốn là ở bên dưới màn hình enter image description here

Điều tôi đang nhận là enter image description here

bất kỳ ý tưởng nào?

+0

bất kỳ may mắn nào làm việc này? – AhmedW

+0

Nope @AhmedW i did not –

Trả lời

0

Để trả lời câu hỏi của riêng tôi, đây là không thể với bất kỳ API công cộng

Tôi đã tìm kiếm hơn một năm nhưng điều này là không thể xảy ra với bất kỳ API công cộng, nhưng tôi đoán có thể có một số API tin để làm điều này (và có thể làm điều đó sẽ khiến ứng dụng của chúng tôi bị từ chối).

Tiện ích con của ứng dụng lịch đang làm giống như những gì tôi muốn làm nhưng API của Apple sẽ không cho phép chúng tôi sử dụng nó. lol

1

Tôi thực sự không nghĩ rằng có cách để làm điều này. Ngay cả khi tạo sự kiện lịch mới từ ứng dụng Thư mặc định sẽ mở ra giao diện ngày theo lịch. Nếu chức năng này là có thể tôi chắc chắn rằng họ sẽ có ít nhất thực hiện nó trong ứng dụng thư mặc định.

Các vấn đề liên quan