在我的代码中,我正在检索用户提醒并向他们显示一个表格视图。每当我在代码中打印 NSLog 时,表格数组就会正确显示。但是,每当我在代码中省略 NSLog 时,我的数据就不再正确显示。提醒的“标题”值返回 (null)。
我每次都能重现这个问题。有人知道这里发生了什么吗?
- (void)shareReminderButtonAction:(UIButton *)buttonEvent {
EKEventStore *store = [[EKEventStore alloc] init];
NSPredicate *predicate = [store predicateForRemindersInCalendars:nil];
[store requestAccessToEntityType:EKEntityTypeReminder completion:^(BOOL granted, NSError *error) {
[store fetchRemindersMatchingPredicate:predicate completion:^(NSArray *reminders) {
ReminderView *shareRem = [[ReminderView alloc]init];
NSLog(@"Reminders: %@", reminders);
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:shareRem];
[navigation setNavigationBarHidden:YES];
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:navigation animated:YES
completion:^(void){[shareRem setArray:reminders];}];
}];
}];
}
在上面的代码中使用 NSLog 记录数据:
"EKReminder <0x1d5b3630> {title = Gdghv; dueDate = 2013-03-06 22:00:00 +0000; completionDate = (null); priority = 0; calendarItemIdentifier = 0BD2CB76-588B-4103-86B0-D71D22317DC0}"
在我上面的代码中接收没有 NSLog 的数据时,在 UITableViewController 端记录数据:
CADObjectGetInlineStringProperty failed fetching title for EKPersistentReminder with error Error Domain=NSMachErrorDomain Code=268435459 "The operation couldn\342\200\231t be completed. (Mach error 268435459 - (ipc/send) invalid destination port)"
"EKReminder <0x1c5e6fd0> {title = (null); dueDate = (null); completionDate = (null); priority = 0; calendarItemIdentifier = (null)}"
非常感谢!