当我在完成块中调用performSegueWithIdentifier时,如果我没有将调用包装在dispatch_async中,则实际发生segue需要10秒钟.但是,我可以做其他事情而不将它们包装在同一个dispatch_async中,例如进行核心
任何关于这如何工作的原因以及为什么……我迷失了.如果这不是问这样的事的正确的地方,我道歉.
EKEventStore *store = [[EKEventStore alloc] init];
[store requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[self performSegueWithIdentifier:self.phaseSegue sender:self];
});
}];
从
documentation:
When the user taps to grant or deny access, the completion handler will be called on an arbitrary queue.
此外,所有与UI相关的东西必须在主队列上完成.这就是你需要dispatch_async的方式.
