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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:29:26+00:00 2026-05-14T16:29:26+00:00

In the Application Delegate didFinishLaunching method, I am using the following code to build

  • 0

In the Application Delegate didFinishLaunching method, I am using the following code to build up a new NSDictionary to be used as the new settings bundle for the user:

NSNumber *testValue = (NSNumber*)[[NSUserDefaults standardUserDefaults] objectForKey:@"settingsversion"];
if (testValue == nil)
{
    NSNumber *numNewDB = [NSNumber numberWithBool:NO];
    NSNumber *numFirstUse = [NSNumber numberWithBool:YES];
    NSDate *dateLastStatic = [NSDate date];
    NSDate *dateLastMobile = [NSDate date];
    NSNumber *numSettingsversion = [NSNumber numberWithFloat:1.0];

    NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
                                 numNewDB, @"newdb",
                                 numFirstUse, @"firstuse",
                                 numSettingsversion, @"settingsversion",
                                 dateLastStatic, @"laststaticupdate",
                                 dateLastMobile, @"lastmobileupdate",
                                 nil];
    [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

Later in another ViewController I am trying to read back a value from that same Dictionary, saved as the NSUserDefaults – well at least I thought it would, but I don’t get any valid object pointer for the desired member lastUpdate back there:

in .h file:

NSDate *lastUpdate;

in the .m file in a member function:

lastUpdate = (NSDate *)[[NSUserDefaults standardUserDefaults] objectForKey:@"laststaticupdate"];

Even, if I print out the content of [NSUserDefaults standardUserDefaults] I only get this:

2010-04-29 15:13:22.322 myApp[4136:207] Content of UserDefaults: <NSUserDefaults: 0x11d340>

This leads me to the conclusion that there is no standardUserDefaults dictionary somewhere in memory or it cannot be determined as such a structure.

Edit: Every time, I restart the app ión the device, the check for testValue is Nil and I am building up the dictionary again but after one run it should be persistent on the Phone, right?

Am I doing something wrong somewhere in between? I have the feeling that I yet didn’t really understand how to load and save settings persistent for a certain application on the iPhone.

Is there anything I have to do additionally to this? Integrating a settings.bundle in XCode or saving the dictionary manually to the Documents folder?

Can someone help me out here? Thanks a lot!

  • 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-14T16:29:27+00:00Added an answer on May 14, 2026 at 4:29 pm

    registerDefaults doesn’t actually write anything to disk. It just creates a ‘defaults defaults’ dictionary in memory. So everytime you restart the app, testValue should be nil.

    If you want to set persistent values, use setObject:forKey:.

    I don’t know why you aren’t getting a valid object back however.

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

Sidebar

Ask A Question

Stats

  • Questions 413k
  • Answers 413k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Do you really need an installer? It's most macish to… May 15, 2026 at 8:20 am
  • Editorial Team
    Editorial Team added an answer If you develop for the .NET Framework Version 4.0, you… May 15, 2026 at 8:20 am
  • Editorial Team
    Editorial Team added an answer Whether your database library is functional or object oriented is… May 15, 2026 at 8:20 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.