当我尝试推送一个视图控制器时,我遇到以下错误访问。这是一个随机错误,有时会发生。有一个类中我使用了CFRunLoopRun();
,一旦我推送了那个类,那么只会出现这个错误。我正在尝试,但问题仍未解决。
让我向您展示我使用CFRunLoopRun();
的代码。如果我做错了什么,请告诉我。
bool _WebTryThreadLock(bool), 0xa871560: Multiple locks on web thread not allowed! Please file a bug. Crashing now...
1 0x5068c88 WebRunLoopLock(__CFRunLoopObserver*, unsigned long, void*)
2 0x2eb6afe __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
3 0x2eb6a3d __CFRunLoopDoObservers
4 0x2e94704 __CFRunLoopRun
5 0x2e93f44 CFRunLoopRunSpecific
6 0x2e93e1b CFRunLoopRunInMode
7 0x5068c50 RunWebThread(void*)
8 0x9465a5b7 _pthread_start
9 0x94644d4e thread_start
[self fatchAllEvent];
CFRunLoopRun(); // i want to wait until above method get executed
-(void)fatchAllEvent{
events = [[NSMutableArray alloc]init];
eventStore = [[EKEventStore alloc] init];
if ([eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)])
{
[eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error)
{
if (granted)
{
[self performSelectorOnMainThread:@selector(waitAsItoldYou)
withObject:nil
waitUntilDone:YES];
CFRunLoopStop(CFRunLoopGetMain());
// NSLog(@"LOOP has STOP");
}
}];
}
}
其他一切都很完美,但出现了这种错误。我读过人们面临的类似问题的解决方案,但都没有帮助。有指针吗?
我正在重新加载一个表,错误即将到来。tableView reloadData
命令也不是线程安全的。
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
});