我崩溃了:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIKeyboardTaskQueue performTask:] may only be called from the main thread.'

而且我两天都找不到解决方案。
这是代码:
[alert dismissWithClickedButtonIndex:0 animated:YES];
UIAlertView *noTicketAlert = [[UIAlertView alloc] initWithTitle:@"Aradığınız kriterlere uygun bilet bulunamadı!" message:nil delegate:self cancelButtonTitle:@"Tamam" otherButtonTitles: nil];
[noTicketAlert show];

最佳答案

我通过尝试从后台线程显示警报来触发此错误。固定如下:

dispatch_async(dispatch_get_main_queue(), ^{
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:...
    [alertView show];
});

关于ios7 - UIAlertView使程序崩溃,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19005463/

10-13 04:21