Kal日历在模拟器中从日历中获取数据,但不在设备上

时间:2012-11-20 09:30:54

标签: objective-c ios github calendar ios-simulator

我正在尝试将Kal日历应用到我自己的项目中。我已经下载了github项目的副本并在模拟器上运行它。一切正常,并显示模拟器日历中的数据。

但是当我在真实设备上测试时。它没有获取数据,它给我以下错误。

CalendarApp[1024:1103] Predicate call to calendar daemon failed: Error Domain=EKCADErrorDomain Code=1013 "The operation couldn’t be completed. (EKCADErrorDomain error 1013.)"

这就是我的fetch的样子。

- (void)presentingDatesFrom:(NSDate *)fromDate to:(NSDate *)toDate delegate:(id<KalDataSourceCallbacks>)delegate
{
  // asynchronous callback on the main thread
  [events removeAllObjects];
  NSLog(@"Fetching events from EventKit between %@ and %@ on a GCD-managed background thread...", fromDate, toDate);
  dispatch_async(eventStoreQueue, ^{
    NSDate *fetchProfilerStart = [NSDate date];
    NSPredicate *predicate = [eventStore predicateForEventsWithStartDate:fromDate endDate:toDate calendars:nil];
    NSArray *matchedEvents = [eventStore eventsMatchingPredicate:predicate];
    dispatch_async(dispatch_get_main_queue(), ^{
      NSLog(@"Fetched %d events in %f seconds", [matchedEvents count], -1.f * [fetchProfilerStart timeIntervalSinceNow]);
      [events addObjectsFromArray:matchedEvents];
      [delegate loadedDataSource:self];
    });

有人能帮助我吗?

亲切的问候和提前谢谢

1 个答案:

答案 0 :(得分:0)

好的,所以它与用户权限有关。我在这里找到了答案。

How to get the name/id of default calendar in iOS 6