在我的应用程序中,我添加了一个按钮来添加提醒iPhone calendar
。我已经使用EKEventEditViewController.
它呈现给 user 和 user add to calender
。它在我的 iPhone 上运行,而且我发现应用程序列在calender privacy setting
. 但客户端在“iPhone 日历隐私设置”中找不到应用程序。我必须在 plist 中进行任何设置吗?
问问题
345 次
1 回答
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];
}
用户运行应用程序一次后,该应用程序将显示在隐私设置中。
于 2013-02-20T14:39:03.267 回答