2013-02-20 149 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]; 

} 

用户运行应用程序一次后,该应用程序将显示在隐私设置中。

相关问题