質問

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'

役に立ちましたか?

解決

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.

他のヒント

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];
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top