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 7884185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:43:51+00:00 2026-06-03T04:43:51+00:00

I am trying to open a special viewController if it is the users first

  • 0

I am trying to open a special viewController if it is the users first time on my App. I’ve gotten this to work before in other situations but for some reason it isn’t working now. I’ve tried two different approaches and neither one is working. The first thing I tried is checking and doing it straight from the appDelegate…then I tried checking if it was the first time from the root view controllers viewDidLoad method and if it is the first time calling the seque to open a special registration page. Niether is working and I have no idea why…..Here is some of the code I’m using:

This is inside the rootviewcontroller. When I do it it prints out “Main is First Time” on the log so I know it is making it there. I double checked the segue in the storyboard and it is named correctly and goes to and from the right places….

- (void)viewDidLoad
{
    [super viewDidLoad];

    appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    if([appDelegate firstTime])
    {
    [self performSegueWithIdentifier:@"mToRegister" sender:self];
        NSLog(@"Main is First time");
    }
    // Do any additional setup after loading the view.
}

Inside the appDelegate:

NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];
BOOL haveused = [standardUserDefaults boolForKey:@”haveused”];

if(haveused){       
    //NOT THEIR FIRST TIME
    //Handle scenario
    firstTime = NO;

    NSString* guid = [[NSMutableString alloc]initWithString:[self getMacAddress]];
    //interest = [appDelegate interest];

    NSString *splitter = [[NSString alloc]initWithString:@"&"];
    NSMutableString *post = [[NSMutableString alloc]initWithString: @"user_read=1&guid="];
    [post appendString:guid];
    NSLog(@"String for Post is %@", post);
    NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
    NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
    [request setValue:@"Basic ==" forHTTPHeaderField:@"Authorization"];
    [request setURL:[NSURL URLWithString:@"http://something.com/app/usercrud.php"]];
    [request setHTTPMethod:@"POST"];
    [request setValue:postLength forHTTPHeaderField:@"Content-Length"];
    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    [request setHTTPBody:postData];

    theConnection = [[NSURLConnection alloc]initWithRequest:request delegate:self];
}
else {
        NSLog(@"This is the First time");
        firstTime = YES;
        //THEIR FIRST TIME
        //Handle scenario



//        UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone"
//                                                                 bundle: nil];
//        
//        UIViewController *controller = (UIViewController*)[mainStoryboard 
//                                                           instantiateViewControllerWithIdentifier: @"register"];
//        UIViewController *root = (UIViewController *)self.window.rootViewController;
//        [root presentModalViewController:controller animated:YES]; 
        [self.window.rootViewController performSegueWithIdentifier:@"mToRegister" sender:self];        

    }

Any ideas why it wouldn’t be working? If not anybody know a better way to handle this situation?

  • 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-06-03T04:43:53+00:00Added an answer on June 3, 2026 at 4:43 am

    i thing your app delegate is not properly managed, use NSDefaults to store the any identity that is unique and check on next start, if that exists in NSDefaults then this is not for first time, and if it doesn’t exists, it is not the first time. test if, and if still prblm exists, then post your if part from app delegate too

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to open a Socket on Android but everytime I try I
I'm trying to open a pop-up menu from a NSToolbarItem. I tried following this
I'm trying to open a textfile and remove all the special chars ñ Ñ
I've been trying to build this small java app. I find it very difficult
in the past hour i have been trying different variants of this query but
Not sure if this is even possible but I am trying to save text
I'm trying to create an Open Office spreadsheet programmatically but for some reason simply
I'm trying to open a file with regular HTML and special Unicode characters such
I am trying to prevent from having to escape apostrophes and other special characters
I am trying to use this c socket class , but it only works

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.