我的应用程序包含UIPageViewController中嵌入的UITableViewController,不时会引发此异常:
Invalid parameter not satisfying: [views count] == 3
Run Code Online (Sandbox Code Playgroud)
回溯:
* 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 …Run Code Online (Sandbox Code Playgroud) 我正在开发一个使用的项目UISlideViewController.我知道这可能是一个重复的问题,但关于这个主题之前的帖子没有帮助我.我有一个特定的问题,因为我设法理解.我的应用程序崩溃了.我之前已经阅读过,将所有工作与UI放在主线程中非常重要.这是代码:
pageViewController.setViewControllers([viewController],
direction: direction,
animated: animated,
completion: { completed in
dispatch_async(dispatch_get_main_queue()) {
...
Run Code Online (Sandbox Code Playgroud)
我得到的错误是下一个:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Duplicate states in queue'
*** First throw call stack:
(0x183fd1900 0x18363ff80 0x183fd17d0 0x18494499c 0x1894dc9f4 0x1894dcdec...)
Run Code Online (Sandbox Code Playgroud)
进一步测试我也在同一行代码上得到这个错误:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'No view controller managing visible view <UITableView: 0x12744aa00;
frame = (0 0; 375 515);
clipsToBounds = YES; autoresize = W+H;
gestureRecognizers = <NSArray: 0x12836cf60>;
layer = <CALayer: 0x1286226b0>;
contentOffset: {0, …Run Code Online (Sandbox Code Playgroud) 我在我的应用程序中使用 pageViewController 当它的父视图被推送到导航堆栈时工作正常,但是当它的父视图显示在窗口中时,它会在导航到下一个 viewController 时崩溃,但异常。
无效参数不满足:[views count] == 3
配置为:
transitionStyle = .scroll
setViewControllers(...animated:true...)
Run Code Online (Sandbox Code Playgroud)
StackOverflow 上已经有很多关于此的问题。
Crash1提供了两种解决方案,但一种不适用于我的情况。(textField) 和其他不起作用 (DispathMainQueue)。
Crash2,我试过在里面设置视图控制器DisptachMainQueue但它不起作用,设置setViewControllers(...animated:false...)和transitionStyle: .pageCurl工作但是有没有其他方法可以使用animated:true和transitionStyle: .scroll使用 Swift 4?