I want to go Root view Controller from another view controller but i got the terminating error. following is the error message in console,
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray removeObjectsInRange:]: index (4) beyond bounds (1)'
This is my code for that
NSArray *arr=self.navigationController.viewControllers;
[self.navigationController popToViewController:[arr objectAtIndex:2] animated:YES];
So any one can give me the suggestion on it so can remove the crash
The NavigationController has a method called to pop to its root view controller. Maybe you should use this one instead.
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated
Related
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];
I have an XIB that I present as a modal view. I have a button that calls the following -
(IBAction)dismissVC:(id)sender {
[self.parentViewController dismissModalViewControllerAnimated: YES];
}
When I press it the app crashes with this notice -
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController dismissVC:]: unrecognized selector sent to instance 0x8379350'
The thing I noticed is that I have a ViewController.xib file and I have this MapView.xib that is a modal VC I want to dismiss. It's presented from a ViewController.xib
What could be the possible issue? I've hooked up all the actions and the File Onwer thing as well.
Thanks in advance!
Try this:
unrecognized selector sent to instance
that might be your solution.
I canĀ“t find nothing about:
UIPopoverController _presentPopoverBySlidingIn:fromEdge:ofView:animated:stateOnly:notifyDelegate:
I got following error message:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIPopoverController _presentPopoverBySlidingIn:fromEdge:ofView:animated:stateOnly:notifyDelegate:]: Popovers cannot be presented from a view which does not have a window.'
I start my iPad-App in Portrait-Mode. And because I need some steps to be done from the master-VC, I present the Popover-Controller programmatically via
[ _masterPopoverController presentPopoverFromBarButtonItem:self.navigationItem.leftBarButtonItem permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];
When I want to dismiss the Popover manually (via touch or swipe outside the popover), the above error occurs.
The problem exists since iOS 5.1.
I'm Calling MainMenu View as:
MainMenu *obj=[[MenuViewController alloc] init];
[self presentModalViewController:obj animated:NO];
But it shows following error..
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "MenuViewController" nib but the view outlet was not set.'
* Call stack at first throw:
Please Fix it.. thank you..
You need to open your nib in interface builder and connect your view with the view in File's Owner
i think your problem clearly in the error try to catch that error
loadViewFromNibNamed:bundle:] loaded the "MenuViewController" nib.....>>> but the view outlet was not set
Open your nib file and set your view outlet.
I created a tableView which worked fine in a single view app but as soon as I changed the view controller for a Tab Bar Controller and tapped the tab for the view with the table view in I suddenly get this! What has gone wrong?
[Session started at 2010-03-28 15:30:15 +0100.]
2010-03-28 15:30:17.763 LogbookTable[13473:207] *** -[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x3b14d10
2010-03-28 15:30:17.765 LogbookTable[13473:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x3b14d10'
2010-03-28 15:30:17.766 LogbookTable[13473:207] Stack: (
29303899,
2465178889,
29685819,
29255286,
29107906,
4372518,
4379894,
4378891,
3095430,
3035941,
3077376,
3065931,
55820976,
55820399,
55818438,
55817530,
2739877,
2763572,
2745983,
2773089,
37399897,
29088640,
29084744,
2739733,
2777007,
10496,
10350
)
You have an UIViewController somewhere, that should be an UITableViewController. Check your view hierarchy in Interface Builder.