2

'NSInternalInconsistencyException', reason: 'ERROR: UIScrollView does not support multiple observers implementing _scrollViewWillEndDraggingWithVelocity:targetContentOffset:'

I checked all related questions but not got exactly problem is where.

I have a custom Tab bar and by defaults first is selected and when we select the second tab and come back on first. I got the app to crash.

enter image description here

Thanks in advance

Parth
  • 634
  • 8
  • 15

2 Answers2

0

Are you manually adding KVO to your code?

If so, you need to add

[[NSNotificationCenter defaultCenter] removeObserver:self]

in your view controllers - (void)viewWillDisappear:(BOOL)animated method.

Also, it seems like you are observing a selector that is already observed by the scroll view internally, do not subscribe to selectors that are used internally by UIKit

see removing observers

Mthokozisi
  • 171
  • 2
  • 12
0

I just simply replace code at the time of push and my problem solved.

 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)

instead below code

 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()
Parth
  • 634
  • 8
  • 15