Cocoa touch 奇怪的数据解析问题

Cocoa touch 奇怪的数据解析问题,cocoa-touch,Cocoa Touch,在我的代码中,我检索用户提醒并将其显示为tableview。 每当我在代码中打印NSLog时,表数组就会正确显示。但每当我在代码中省略NSLog时,我的数据就不再正确显示。提醒的“标题”值返回(null) 我每次都能复制这个问题。有人知道这里发生了什么吗 - (void)shareReminderButtonAction:(UIButton *)buttonEvent { EKEventStore *store = [[EKEventStore alloc] init]; NSPredica

在我的代码中,我检索用户提醒并将其显示为tableview。 每当我在代码中打印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}"
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)}"
“ekMemention{title=Gdghv;dueDate=2013-03-06 22:00:00+0000;completionDate=(null);优先级=0;calendarItemIdentifier=0BD2CB76-588B-4103-86B0-D71D22317DC0}”
在上面的“我的代码”中接收不带NSLog的数据时,在UITableViewController端记录数据:

"EKReminder <0x1d5b3630> {title = Gdghv; dueDate = 2013-03-06 22:00:00 +0000; completionDate = (null); priority = 0; calendarItemIdentifier = 0BD2CB76-588B-4103-86B0-D71D22317DC0}"
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)}"
CADObjectGetInlineStringProperty无法获取EkPersistentRenderMinder的标题,错误为Domain=NSMachErrorDomain code=268435459“操作无法\342\200\231完成。(Mach错误268435459-(ipc/send)目标端口无效)”
“{title=(null);dueDate=(null);completionDate=(null);priority=0;calendarItemIdentifier=(null)}”

非常感谢

在您使用事件工具包对象的整个过程中,EKEventStore对象都需要保留。通常最好是把它安置在一个单身家庭里。发件人:

EKEventStore对象需要相对较长的时间来创建 初始化并释放。因此,您不应该初始化和 为每个与事件相关的任务释放单独的事件存储。相反 在应用加载时初始化单个事件存储,并使用它 反复使用,以确保您的连接是长期的

事件存储实例不能在其他事件工具包之前释放 物体;否则,可能会发生未定义的行为


你只使用了不合适的标签。恭喜…我发现了我遇到的问题。EKEventStore显然发布得太早了。我把它放在我的viewDidLoad方法中,一切都很好!