-1

I'm using the following pages

-MenuViewController
-ViewController(Main)
-ListViewController

ECSlidingViewController created using the menu. ViewController (main) menu on page directly open, but when I try to open a subpage menu with the following line of listviewcontroller get the error:

[self.view addGestureRecognizer:self.slidingViewController.panGesture];

I received the error are as follows:

-[__NSArrayM insertObject:atIndex:]: object cannot be nil'

Puneet Sharma
  • 9,369
  • 1
  • 27
  • 33

2 Answers2

0

The NSArray method insertObject:atIndex does not accept nil. If you do want to insert a nil object into an array, or rather, a representation of a nil entry, use [NSNull null], so you have:

[myArray insertObject[NSNull null] atIndex:myIndex]

In your case, however, probably the root cause of the error is that self.slidingViewController.panGesture is nil.

Max MacLeod
  • 26,115
  • 13
  • 104
  • 132
0

I got this issue too. I issue was that when I added the ECSlidingViewController. I still had one of my functions connecting to the topviewcontroller

 [[UIApplication sharedApplication].keyWindow setRootViewController: topViewController];

When I needed to make sure it was connected to the initial view controller for the ECSlidingViewController.

 [[UIApplication sharedApplication].keyWindow setRootViewController: initialEXViewController];
Michael Choi
  • 285
  • 1
  • 3
  • 15