调用dismissModalViewController将间歇性地导致EXC_BAD_ACCESs。iOS dismissModalViewController导致EXC_BAD_ACCESS
间歇性与特定构建有关,而不是特定运行。也就是说,如果可执行文件已编译完成,调用将始终通过或一直失败。
它似乎并不取决于代码是否在构建之间更改过。
我们使用iPhone 5.1模拟器和安装了iOS 5.1的iPod touch第4代。这种行为出现在模拟和物理设备上
有没有人见过这个?我们在智慧的结尾。
这里的两种情况的模态视图控制器被提出,以及那里得到驳回:
PaymentStack* paymentStack =
[[PaymentStack alloc] initWithOrder:[anOrderManager thisOrder] locationState:[appData locationState]
successBlock:^{
//Push the current order on the history list
[[appData ordersHistory] addObject:[anOrderManager thisOrder]];
if ([[anOrderManager thisOrder] isEffectivelyEqual:[anOrderManager thisOrder]])
{
//Allocate a new order
[anOrderManager setOrder:[[Order alloc] init]];
}
}
completionBlock:^{
[self dismissViewControllerAnimated:YES
completion:^{
NSLog(@"Complete.");
}];
}
cancellationBlock:^{
[self dismissViewControllerAnimated:YES
completion:^{
NSLog(@"Cancellation.");
}];
}];
[self presentModalViewController:[paymentStack navigationController] animated:YES];
这里的堆栈跟踪:
#0 0x00d659ab in -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:]()
#1 0x00b4ea9c in -[UIViewController _dismissViewControllerWithTransition:from:completion:]()
#2 0x00b4df91 in -[UIViewController dismissViewControllerWithTransition:completion:]()
#3 0x00b4ec81 in -[UIViewController dismissViewControllerAnimated:completion:]()
#4 0x00071135 in __35-[MasterViewController placeOrder:]_block_invoke_0186 at /Users/jake/Documents/Avocado/AvocadoTest1.0/MasterViewController.m:258
#5 0x000515c0 in __91-[PaymentStack initWithOrder:locationState:successBlock:completionBlock:cancellationBlock:]_block_invoke_0()
#6 0x000545c8 in __27-[PaymentStack showSuccess]_block_invoke_0230()
#7 0x000558cc in -[PaymentCompleteViewController done]()
#8 0x01a47e99 in -[NSObject performSelector:withObject:withObject:]()
#9 0x00a8214e in -[UIApplication sendAction:to:from:forEvent:]()
#10 0x00cc0a0e in -[UIBarButtonItem(UIInternal) _sendAction:withEvent:]()
#11 0x01a47e99 in -[NSObject performSelector:withObject:withObject:]()
#12 0x00a8214e in -[UIApplication sendAction:to:from:forEvent:]()
#13 0x00a820e6 in -[UIApplication sendAction:toTarget:fromSender:forEvent:]()
#14 0x00b28ade in -[UIControl sendAction:to:forEvent:]()
#15 0x00b28fa7 in -[UIControl(Internal) _sendActionsForEvents:withEvent:]()
#16 0x00b28266 in -[UIControl touchesEnded:withEvent:]()
#17 0x00aa73c0 in -[UIWindow _sendTouchesForEvent:]()
#18 0x00aa75e6 in -[UIWindow sendEvent:]()
#19 0x00a8ddc4 in -[UIApplication sendEvent:]()
#20 0x00a81634 in _UIApplicationHandleEvent()
#21 0x03dd9ef5 in PurpleEventCallback()
#22 0x01a1a195 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__()
#23 0x0197eff2 in __CFRunLoopDoSource1()
#24 0x0197d8da in __CFRunLoopRun()
#25 0x0197cd84 in CFRunLoopRunSpecific()
#26 0x0197cc9b in CFRunLoopRunInMode()
#27 0x03dd87d8 in GSEventRunModal()
#28 0x03dd888a in GSEventRun()
#29 0x00a7f626 in UIApplicationMain()
#30 0x000025ed in main at /Users/jake/Documents/Avocado/AvocadoTest1.0/AvocadoTest1/main.m:16
如果有一个更好的办法,我可以格式化这个为你,让我知道。
显示您的代码。 – WrightsCS 2012-03-28 15:42:38
好的,我会为你发布。 – jknielse 2012-03-28 15:44:30
您能否显示堆栈跟踪?你有没有试过用僵尸或静态分析器运行探查器? – 2012-03-28 15:45:27