Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/113.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 由于未捕获的异常而终止应用程序,原因:';错误:UIScrollView不支持多个观察者_Ios_Swift_Xcode_Uiscrollview - Fatal编程技术网

Ios 由于未捕获的异常而终止应用程序,原因:';错误:UIScrollView不支持多个观察者

Ios 由于未捕获的异常而终止应用程序,原因:';错误:UIScrollView不支持多个观察者,ios,swift,xcode,uiscrollview,Ios,Swift,Xcode,Uiscrollview,“NSInternalInconsistencyException”,原因:“错误:UIScrollView不支持多个观察者实现_scrollViewWillEndDraggingWithVelocity:targetContentOffset:” 我检查了所有相关的问题,但并没有得到确切的问题是在哪里 我有一个自定义选项卡栏,默认情况下,第一个选项卡处于选中状态,当我们选择第二个选项卡并返回第一个选项卡时。我让应用程序崩溃了 提前感谢您是否手动将KVO添加到代码中 如果是这样,您需要添加 [

“NSInternalInconsistencyException”,原因:“错误:UIScrollView不支持多个观察者实现_scrollViewWillEndDraggingWithVelocity:targetContentOffset:”

我检查了所有相关的问题,但并没有得到确切的问题是在哪里

我有一个自定义选项卡栏,默认情况下,第一个选项卡处于选中状态,当我们选择第二个选项卡并返回第一个选项卡时。我让应用程序崩溃了


提前感谢

您是否手动将KVO添加到代码中

如果是这样,您需要添加

[[NSNotificationCenter defaultCenter] removeObserver:self]
在视图中,控制器
-(void)视图将消失:(BOOL)动画方法

此外,您似乎正在观察滚动视图内部已观察到的选择器,请勿订阅UIKit内部使用的选择器


请参见

我只需在推送时替换代码,问题就解决了

 self.navigationController?.navigationBar.isHidden = true
    let controller = self.storyboard?.instantiateViewController(withIdentifier: MainStoryBoard.ViewControllerIdentifiers.tabbarViewController) as! TabBarViewController
    controller.selectedIndex = 0
    self.navigationController?.pushViewController(controller, animated: true)
而不是下面的代码

 let sb = UIStoryboard(name: "Main", bundle: nil)
    let controller = sb.instantiateViewController(withIdentifier: MainStoryBoard.ViewControllerIdentifiers.tabbarViewController) as! TabBarViewController
    // Feature Tab
    controller.selectedIndex = 0
    let appdelegate = UIApplication.shared.delegate as! AppDelegate
    appdelegate.window?.rootViewController = controller
    appdelegate.window?.makeKeyAndVisible()

您是否在UINavigationBar中使用标题为的UINavigationController?是@Mrunal,我正在使用。请尝试使用此
self.navigationBar.prefersLargeTitles=false
。否,我没有添加任何KVO或本地通知。