IOS 8 pushViewController not working, in iOS 7 everything works as expected, zero code changes?

When I run my app on iOS 7 everything works as expected. When I run my app on iOS 8, things don't work as expected. This is all without making any changes to the codebase.

Specifically, I'm trying to "push" a new view controller on the stack and in iOS 8 nothing happens. <- This is an error, nothing happens. No crash, just nothing.

At first I thought it might be storyboard related and so switches from running my push segue through performSegueWithIdentifier

to just manually load it from the storyboard with instantiateViewControllerWithIdentifier

and then present it through [self.navigationController pushViewController:myVC animated:YES];

.

Any of the above methods works on iOS 7. However, when running my app on an iOS 8 device, the BOTH crashes fail. Also, I noticed strange behavior in the debugger / NSLog. On iOS 7, when I run NSLog(@"self.navigationController = %@", self.navigationController)

I get (as expected):

self.navigationController = <UINavigationController: 0x145986b0>

On iOS 8 I also get (as expected):

self.navigationController = <UINavigationController: 0x15d646db0>

Meanwhile, at the same point in the code, when I insert a break and then check things through the console like this: (lldb) po self.navigationController

On 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 examples, po

I am creating a "Debug" build configuration.

Ultimately I'm just trying to push the view controller. My original code was using segue. When trying to debug this, I moved away from segue to use instantiateViewControllerWithIdentifier

and [self.navigationController pushViewController:myVC animated:YES];

. Both approaches work as expected on iOS 7. However, no matter what I do, I can't get a nudge to get it working on iOS 8, nothing happens at all, as if the navigation controller was there nil

or something when it wasn't!

Any ideas?

+3


source to share


1 answer


My situation is similar to yours.

I have a VC named InventoryMatrixEditViewController and it is represented by a custom modal presentation. And this VC has a method called in - (void) viewDidLoad; to customize 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 clicked view (self.attributesTableViewController) won't get called (oddly not every time an error is triggered) but the app doesn't crash, just presents an empty modalView and even the nav is not set.

But if the animated flag is NO, everything is fine.

I wonder if this is a bug or if Apple is just nudging people not to activate the animation if the view is presented modally first.

+2


source







All Articles