2012-07-17 28 views
0

這裏是我打電話創建名爲BART本地日曆的方法:爲什麼我的iPhone的iCal顯示在本地源中創建的日曆?

- (void)createCalendar 
{ 
    [self setEventStore: [[EKEventStore alloc] init]]; 

    EKSource *local = nil; 

    for (EKSource *source in eventStore.sources){ 
     if (source.sourceType == EKSourceTypeLocal){ 
      local = source; 
      break; 
     } 
    } 

    NSSet *cals = [local calendars]; 
    NSLog(@"%@\n",cals); 

    [self setBart: [EKCalendar calendarWithEventStore: eventStore]]; 
    bart.source = local; 
    bart.title = @"BART"; 
    [eventStore saveCalendar:bart commit:YES error:nil]; 

} 

當我測試我的iPhone上運行的程序,日曆不會出現在我的iCal,但在Xcode顯示我的輸出窗口本地資源存在並且它包含我創建的日曆。我怎樣才能讓iCal顯示日曆?

+0

你想顯示使用內置的「日曆應用」日曆? – 2012-07-17 16:37:21

+0

是的,我想使用內置的「日曆應用程序」來顯示日曆。 @BlackFrog – user1521318 2012-07-17 17:03:04

回答

0

iOS事件工具包(Calendar API)允許應用程序從用戶的日曆數據庫訪問事件信息。

如果你想在你的應用程序中顯示這些事件,你將不得不創建你自己的UIView。

要使用內置的「校準應用程序」顯示事件,用戶將不得不選擇自己查看他的日曆。你不能從你的應用程序啓動它。

看看以下內容: Does iOS Calendar support a URL scheme? Is there an iPhone URL shortcut for calendar?

相關問題