Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4541270
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:12:34+00:00 2026-05-21T15:12:34+00:00

Hi there I currently I have a warning on a line of code where

  • 0

Hi there I currently I have a warning on a line of code where I am trying to push a new view onto the screen.
Outline // my NSObject receives a code=1 from my server I have set up. Everything works fine the code comes through which then initializes an AlertView where I have set up an if statement to catch the button click of my AlertView message. When that button is pressed my application falls over.

I have declared my ViewController of the view I am trying to push in its header file and there are no errors just the warning when compiled.

this is my NSObject I have made

    /////.h
    #import <Foundation/Foundation.h>


@interface alerts : NSObject {

}

- (void)pleaseRegisterDevice;

@end


/////.m
#import "alerts.h"
#import "instaCode1_3AppDelegate.h"
#import "RegisterDeviceViewController.h"


@implementation alerts

//use this alert when phone falls out of sync
- (void)pleaseRegisterDevice {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Please Register Device"
                                                    message:@"click OK to register"
                                                   delegate:self
                                          cancelButtonTitle:@"OK"
                                          otherButtonTitles:nil];

    [alert autorelease];
    [alert show];

}


//Catch pleaseRegisterDevice method
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
    NSString *buttonTitle=[alertView buttonTitleAtIndex:buttonIndex];
    if ([buttonTitle isEqualToString:@"OK"]) {
        NSLog(@"msg from alertView method");

        //open new wndow

        RegisterDeviceViewController *regViewController = [[RegisterDeviceViewController alloc] init];


        //Push it onto the top pf the navigation controller's stack
        **[[self navigationController] pushViewController:regViewController animated:YES];**



    }
    else {
        NSLog(@"was not able to push view");
    }

}

- (void)dealloc {
    [super dealloc];
}
@end

I have bolded the line of code where I get the warning ‘alerts’ may not respond to -navigationController

any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T15:12:35+00:00Added an answer on May 21, 2026 at 3:12 pm

    I dont think an NSObject subclass has a UINavigationController…
    You need to get a pointer to your app delegate’s navigation controller like so

    MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
    [appDelegate.navigationController pushViewController:regViewController animated:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a better way to do this jquery code? Currently I have to
I'm new to SharePoint and have a general question regarding list comparison. Currently, there
I'm very new to PHP. I have a line of code on a server
I currently have the DatePicker in my project but there are problems due to
I currently have an iPhone project with a tab bar. On the tabbar there
I currently have a Ruby on Rails system, and there are plans to port
We currently have an application that depends largely on stored procedures. There is a
I have a page where there is currently more than one form. I used
I have been using the storyboard to make an application and currently there are
I have an application where there are two types of user currently, Admin and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.