我有許多線程調用由performSeleactoreOnMainThread方法如下功能:EXC_BAD_ACCESS只是偶爾上顯示警報視圖
-(void) showAlert: (NSString *)message{
if ([NSRunLoop currentRunLoop] != [NSRunLoop mainRunLoop]) {
NSLog(@"<< perform in main thread>>");
[self performSelectorOnMainThread:@selector(showAlert:) withObject:message waitUntilDone:NO];
}
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Info" message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
爲,在任何情況下,這種方法只能在主線程中調用,我沒有得到的導致EXC_BAD_ACCESS崩潰的原因: [alert show]
而這次崩潰有時只是有時。請幫忙。
提供崩潰日誌 –