Highlighted

Want to use pushViewController and segues from UINavigationController in AIR app on iOS

Engaged ,
Apr 21, 2015

Copy link to clipboard

Copied

Ok, this might be a long shot, but here goes.

My iOS AIR app includes a bunch of native screens defined in a storyboard.  I have them included by putting them into a native (static) framework, including that framework in an ANE, and adding code to instantiate and add the various ViewControllers to the screen.

I can add a ViewController as a child and get its view to show on the screen with the following obj-c code in my ANE:

[[[[UIApplication sharedApplication] keyWindow] rootViewController] addChildViewController:controller];

        [[[[UIApplication sharedApplication] keyWindow] rootViewController].view addSubview:controller.view];

        [controller didMoveToParentViewController:[[[UIApplication sharedApplication] keyWindow] rootViewController]];

However, some of the views have child views that use segues and the push stack from UINavigationController.  When these screens try to load, I get the following error:

Apr 21 13:50:43 raspberry LKW_Smash[7703] <Error>: *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Could not find a navigation controller for segue 'MemberOptionsSegue'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.'

So I attempted to get access to the app's UIViewController, and push the new ViewController onto the stack with the following code:

[root.navigationController pushViewController:controller animated:YES];

But root.navigationController is nil!  It looks like the app doesn't have one!

So after all that, my question is this: How do I create an AIR app that includes a UINavigationController and is not simply just a single-view app?

TOPICS
Development

Views

1.2K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Want to use pushViewController and segues from UINavigationController in AIR app on iOS

Engaged ,
Apr 21, 2015

Copy link to clipboard

Copied

Ok, this might be a long shot, but here goes.

My iOS AIR app includes a bunch of native screens defined in a storyboard.  I have them included by putting them into a native (static) framework, including that framework in an ANE, and adding code to instantiate and add the various ViewControllers to the screen.

I can add a ViewController as a child and get its view to show on the screen with the following obj-c code in my ANE:

[[[[UIApplication sharedApplication] keyWindow] rootViewController] addChildViewController:controller];

        [[[[UIApplication sharedApplication] keyWindow] rootViewController].view addSubview:controller.view];

        [controller didMoveToParentViewController:[[[UIApplication sharedApplication] keyWindow] rootViewController]];

However, some of the views have child views that use segues and the push stack from UINavigationController.  When these screens try to load, I get the following error:

Apr 21 13:50:43 raspberry LKW_Smash[7703] <Error>: *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Could not find a navigation controller for segue 'MemberOptionsSegue'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.'

So I attempted to get access to the app's UIViewController, and push the new ViewController onto the stack with the following code:

[root.navigationController pushViewController:controller animated:YES];

But root.navigationController is nil!  It looks like the app doesn't have one!

So after all that, my question is this: How do I create an AIR app that includes a UINavigationController and is not simply just a single-view app?

TOPICS
Development

Views

1.2K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 21, 2015 0

Have something to add?

Join the conversation