2013-02-20 62 views
2

在我的應用程序中,我添加了一個按鈕來向iPhone calendar添加提醒。我已經使用EKEventEditViewController.它被提供給用戶和用戶add to calender。它正在使用我的iPhone,並且我在calender privacy setting中找到應用程序。但客戶端無法找到iPhone iPhone日曆隱私設置中列出的應用程序。我有必要做一下plist的任何設置嗎?日曆在隱私設置中不顯示應用程序

回答

0

我要去假設應用程序是針對iOS 6的

記住應用程序必須「問」的用戶,如果應用程序可以訪問該日曆。

[eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) { 
     [self performSelectorOnMainThread:@selector(showCalendarEventViewControllerWithEventStore:) withObject:eventStore waitUntilDone:YES]; 
    }] ; 

-(void) showCalendarEventViewControllerWithEventStore: (EKEventStore *) eventStore 
{ 
    EKEventEditViewController * vc = [[EKEventEditViewController alloc] init]; 

    EKEvent* event = [EKEvent eventWithEventStore:eventStore]; 
    event.title = [NSString stringWithFormat:@"Take %@" , self.prescription.lastFilledLabelName]; 
    event.startDate = [[NSDate date] dateByRoundingToNextMinute:15]; 
    event.endDate = [event.startDate dateByAddingTimeInterval:15*60]; 
    event.notes = self.prescription.directions; 
    EKAlarm *alarm = [EKAlarm alarmWithRelativeOffset:-15*60] ; 
    event.alarms = [NSArray arrayWithObject:alarm]; 

    vc.eventStore = eventStore; 
    vc.event = event; 

    vc.editViewDelegate = self; 
    vc.modalTransitionStyle = UIModalTransitionStyleCoverVertical; 
    [self presentViewController:vc animated:YES completion:nil]; 

} 

用戶運行應用程序一次後,該應用程序將顯示在隱私設置中。

相關問題