Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS App crashes when pressing Button with NavigationController
    primarykey
    data
    text
    <p>I am new to objective-c and I am currently working on an iOS App. I have a Button i call SettingsButton, that is inside a custom UIView Object. When I press on this Button the Touch Up Inside handler of the FileOwner "ViewController.m" is called, which later shall push a ViewController on the NavigationController. But the Application crashes with SIGABRT or EXC_BAD_ACCESS. This is occurring since I inserted the code with the NavigationController in AppDelegate.m Any ideas?</p> <p><strong>AppDelegate.m:</strong></p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. UIViewController *vc; if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { vc = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil]; } else { vc = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil]; } UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:vc]; navController.navigationBarHidden = true; [self.window addSubview:navController.view]; [self.window makeKeyAndVisible]; return YES; } </code></pre> <p><strong>ViewController.m:</strong></p> <pre><code>- (IBAction)SettingsPressed:(id)sender { NSLog(@"SettingsPressed!"); } </code></pre> <p>To make clear: My intention is only to change view when pressing the SettingsButton and having a Back-Button to return back. But the App already crashes with empty Eventhandler.</p> <p><strong>Errormessage</strong> when sigabrt occurs:</p> <pre><code>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString SettingsPressed:]: unrecognized selector sent to instance 0x7a06fc0' </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload