Reputation: 9528
When I run my app on iOS 7 things work as expected. When I run my app on iOS 8 things do NOT work as expected. This is all without making a single edit to the codebase.
Specifically, I'm trying to "push" a new view controller on the stack and in iOS 8 nothing happens. <-- That's the bug, nothing happens. No crash, just nothing.
At first I thought it might be storyboard related and so switched from triggering my push segue via performSegueWithIdentifier
to just manually loading it from the storyboard using instantiateViewControllerWithIdentifier
and then presenting it via [self.navigationController pushViewController:myVC animated:YES];
.
Either of the above techniques works on iOS 7. However, BOTH approaches fail when running my app on an iOS 8 device. Furthermore, I've noted weird behavior in the debugger/NSLog. In iOS 7 when I run NSLog(@"self.navigationController = %@", self.navigationController)
I get (as expected):
self.navigationController = <UINavigationController: 0x145986b0>
In iOS 8, I ALSO get (as expected):
self.navigationController = <UINavigationController: 0x15d646db0>
Meanwhile, at that same point in the code, when I insert a break and then check things out via the console like so: (lldb) po self.navigationController
In iOS 7, I get (as expected):
(lldb) po self.navigationController
<UINavigationController: 0x175810b0>
HOWEVER, in iOS 8, I get:
(lldb) po self.navigationController
error: property 'navigationController' not found on object of type 'PHMenuTableViewController *'
error: 1 errors parsing expression
In both of the above po
examples I'm building with my "Debug" build config.
Ultimately, I'm just trying to push a view controller. My original code was using a segue. While trying to debug this I moved away from the segue to use instantiateViewControllerWithIdentifier
and [self.navigationController pushViewController:myVC animated:YES];
. Both approaches work on iOS 7 as expected. However, no matter what I do I cannot get the push to work on iOS 8, nothing happens at all as if the navigation controller is nil
or something when it's not!
Any ideas?
Upvotes: 3
Views: 3267
Reputation: 3803
My situation is just similar to yours.
I have a VC named InventoryMatrixEditViewController and its is presented by customized modal presentation. And in this VC there is a method called in -(void)viewDidLoad; to setup the layout:
- (void)_setupLayout
{
if (_isToCreateNewMatrix) {
//[self.view addSubview:self.attributesTableViewController.view];
[self.attributesTableViewController addNewAttributeItem];
[self.navigationController pushViewController:self.attributesTableViewController
animated:Yes];
return;
}
....
if the animated flag is Yes, sometimes the viewDidLoad of the pushed view (self.attributesTableViewController) will not be called(strangely not every time the error will be triggered), but the app is not crashed, just present a blank modalView and even the navigationBar is not set.
But if the animated flag is NO, everything is ok.
I wonder if it is a bug or the Apple just push people not to activate the animation if the view is first presented modally.
Upvotes: 2