0

When I click on the Button "Hello World" to go to a new page "View Controller" it gives me these error:

"2015-12-27 16:48:36.939 Projects name [197:60b] * Terminating app due to uncaught exception 'NSGenericException', reason: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController.' * First throw call stack: (0x30689f83 0x3ae3accf 0x33382c21 0x32edc037 0x32edbfd7 0x32edbfb1 0x32ec7717 0x32edba2f 0x32edb701 0x32ed66cb 0x32eab8cd 0x32ea9f77 0x3065520b 0x306546db 0x30652ecf 0x305bdebf 0x305bdca3 0x354c3663 0x32f0a14d 0x51385 0x3b347ab7) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)"

And

#import <UIKit/UIKit.h>
#import "AppDelegate.h"

int main(int argc, char * argv[]) {
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

Can anyone help? I'm a newbie btw.

enter image description here

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
sahaaboo
  • 1
  • 1

1 Answers1

0

The initial ViewController is not inside a UINavigationController. So the push segue cannot be performed.

If you are using Storyboard you can easily fix that

  1. in Xcode open the Storyboard file
  2. select the initial View Controller
  3. choose Editor > Embed In > Navigation Controller

Now it should work.

Luca Angeletti
  • 58,465
  • 13
  • 121
  • 148
  • It works fine, thank you! The thing is I have two pages, the second page got "back" on the top left, that's ok, but the first page got the same thing, how can I remove it? – sahaaboo Dec 27 '15 at 18:38
  • If the first view controller got the `Back` button then I don't think it really is the first one. There should be a previous ViewController. – Luca Angeletti Dec 27 '15 at 18:40
  • As the picture above, it showed a View Controller from "Editor > Embed in > Navigation Controller" on the left of them, so I guess the second one, not the first I mentioned just before :/ – sahaaboo Dec 27 '15 at 18:46