问题描述
我的应用包含嵌入在 UIPageViewController 中的 UITableViewController 不时引发此异常:
My app that contains a UITableViewController embedded in UIPageViewController raises this exception from time to time:
Invalid parameter not satisfying: [views count] == 3
回溯:
* thread #1: tid = 0x6239fa, 0x03d1d88a libobjc.A.dylib`objc_exception_throw, queue = 'com.apple.main-thread, stop reason = breakpoint 25.3
frame #0: 0x03d1d88a libobjc.A.dylib`objc_exception_throw
frame #1: 0x0404f448 CoreFoundation`+[NSException raise:format:arguments:] + 136
frame #2: 0x03428fee Foundation`-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
frame #3: 0x01e7c535 UIKit`-[_UIQueuingScrollView _replaceViews:updatingContents:adjustContentInsets:animated:] + 185
frame #4: 0x01e800ca UIKit`-[_UIQueuingScrollView _didScrollWithAnimation:force:] + 1231
frame #5: 0x01e7bb57 UIKit`-[_UIQueuingScrollView _scrollViewAnimationEnded:finished:] + 104
frame #6: 0x0190583c UIKit`-[UIScrollView(UIScrollViewInternal) animator:stopAnimation:fraction:] + 62
frame #7: 0x0197096e UIKit`-[UIAnimator stopAnimation:] + 533
frame #8: 0x0197100a UIKit`-[UIAnimator(Static) _advanceAnimationsOfType:withTimestamp:] + 325
frame #9: 0x01970b76 UIKit`-[UIAnimator(Static) _LCDHeartbeatCallback:] + 67
frame #10: 0x01663b8a QuartzCore`CA::Display::DisplayLinkItem::dispatch() + 48
frame #11: 0x01663a46 QuartzCore`CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 310
frame #12: 0x01663f6b QuartzCore`CA::Display::TimerDisplayLink::callback(__CFRunLoopTimer*, void*) + 123
frame #13: 0x0400dbd6 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
frame #14: 0x0400d5bd CoreFoundation`__CFRunLoopDoTimer + 1181
frame #15: 0x03ff5628 CoreFoundation`__CFRunLoopRun + 1816
frame #16: 0x03ff4ac3 CoreFoundation`CFRunLoopRunSpecific + 467
frame #17: 0x03ff48db CoreFoundation`CFRunLoopRunInMode + 123
frame #18: 0x0533b9e2 GraphicsServices`GSEventRunModal + 192
frame #19: 0x0533b809 GraphicsServices`GSEventRun + 104
frame #20: 0x01874d3b UIKit`UIApplicationMain + 1225
是否有人已经看到或知道原因可能是什么?
Does anyone have seen this already or have an idea what the reason could be?
推荐答案
在使用此修复程序更多时间后,我有时仍然可以看到该错误,因此这不是完整的修复程序(嗯...它是总是有点像黑客).找到后我会更新实际的解决方案.
after using this fix for more time, I can still see the bug on occasion so this isn't the complete fix (well... it was always kind of a hack). I'll update with the actual solution once I'll find it.
我在使用 UIPageViewController 时遇到了同样的错误.经过数小时调试问题,我发现原因是在 UIPageViewController 的 setViewControllers:direction:animated:completion: 的完成处理程序中使用 UIView 动画.
I've encountered this same error using UIPageViewController. After hours debugging the issue, I've found the cause was using UIView animations inside the completion handler of UIPageViewController's setViewControllers:direction:animated:completion:.
我不知道为什么在那个阶段制作动画会导致断言错误(我没有为 UIPageViewController 或其子视图控制器制作动画),但是在主队列上使用 dispatch_async 包装代码块可以解决问题并停止崩溃.
I don't know why animating at that stage causes the assertion error (I wasn't animating the UIPageViewController or its child view controllers), but wrapping the code block with dispatch_async on the main queue solves the issue and stop the crashing.
这篇关于_UIQueuingScrollView 抛出的无效参数异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!