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

  • Home
  • SEARCH
  • 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 6566949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:16:41+00:00 2026-05-25T14:16:41+00:00

I am creating app for jobsite. It will display login page first. when we

  • 0

I am creating app for jobsite. It will display login page first. when we enter username and password webservice will return userid as response. with this user id we can get jobs.

I want to put jobs screen first and check if user id is null then open loginview. if it is not null then load jobs in tableview. I used Nsuserdefaults to save response when user first enter username password. Every thing is working fine. but userdefault key is showing null in console but my condition is loading output also.. this is strange,.

my code is

-(void)CheckCond{
    NSUserDefaults* storeData = [NSUserDefaults standardUserDefaults];

    NSLog(@"Value for userdefault %@",[storeData objectForKey:@"userId"]);
    NSString *responseValue = [storeData objectForKey:@"userId"];

    NSLog(@"first REsponse value :%@",responseValue);

    if ([responseValue isEqualToString:@""]) {


        [self LoginLogout];


    }
    else
{
    NSLog(@"self.userId %@",self.userId);



        NSUserDefaults* storeData = [NSUserDefaults standardUserDefaults];
        [storeData setObject:self.userId forKey:@"userId"];

        NSLog(@"%@",[storeData objectForKey:@"userId"]);
        [self loadOutput];

    }
}

Console output for first time login is

2011-09-09 13:21:29.438 ITClassifiedUniversal[2718:207] first REsponse
value :(null) 2011-09-09 13:21:29.438 ITClassifiedUniversal[2718:207]
self.userId 77533 2011-09-09 13:21:29.438
ITClassifiedUniversal[2718:207] 77533

After quitting app and restarting console output is :

2011-09-09 13:21:42.044 ITClassifiedUniversal[2731:207] Value for
userdefault (null) 2011-09-09 13:21:42.045
ITClassifiedUniversal[2731:207] first REsponse value :(null)
2011-09-09 13:21:42.045 ITClassifiedUniversal[2731:207] self.userId
(null) 2011-09-09 13:21:42.045 ITClassifiedUniversal[2731:207] (null)

AS above output shows NSUserdefault for userid is null?? whts the problem ?
This user id is coming from login view

// Create and set up job view controller.
                jobView = [[JobViewController alloc] initWithNibName:@"JobView" bundle:nil];
                jobView.userId = self.response;

                // Create a nav controller with job view as its root controller.
                UINavigationController *jobViewNavController = [[UINavigationController alloc] initWithRootViewController:jobView];

                // Present the job view nav controller.
                [self presentModalViewController:jobViewNavController animated:YES];

                [jobView release];
                [jobViewNavController release];
  • 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-25T14:16:41+00:00Added an answer on May 25, 2026 at 2:16 pm
        at last add synchronize statement then its give proper value
        NSUserDefaults* storeData = [NSUserDefaults standardUserDefaults];
    if ([storeData objectForKey:@"userId"]==nil)
    {
                [storeData setObject:self.userId forKey:@"userId"];
    
        [storeData synchronize];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating an app where people will be able to make posts for cities.
hi i am creating app to display ads at bottom. i am done all
I am creating an app that will require authentication which I have already gotten
I'm creating an app where user will be able to select some of his
I'm creating an app that needs to display the phone contacts with its photo,
I'm creating a app that uses a Master Page. But when i go to
I am creating app that download 4-5 images from server and display as gallery.
I'm creating app which uses very large amount of memory. When I finish computation
I am creating app where user can save options witch one is better? to
Im creating an App and I have a header that its the same for

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.