• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Why would +[initialize] be called twice?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why would +[initialize] be called twice?


  • Subject: Why would +[initialize] be called twice?
  • From: "Michael A. Crawford" <email@hidden>
  • Date: Mon, 24 Aug 2009 13:19:22 -0400

Why would the class initializer be called more than once when my app starts up? Is this expected behavior? In case you're wondering, it is called twice.

+ (void)initialize
{
// Create the defaults dictionary, fill it with the standard values,
// and register it.
NSMutableDictionary* defaultValues = [NSMutableDictionary dictionary];


    [defaultValues setObject:[NSNumber numberWithBool:YES]
                      forKey:CDFilterKey];
    [defaultValues setObject:[NSNumber numberWithBool:YES]
                      forKey:CDNotifyUserOnAnalysisCompletionKey];
    [defaultValues setObject:[NSNumber numberWithBool:YES]
                      forKey:CDPlaylistReminderKey];

[[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues];

    MCLog(@"Registered defaults: %@", defaultValues);
}

-Michael
----------------------
We know as much about software quality problems as they knew about the Black Plague in the 1600s. We've seen the victims' agonies and helped burn the corpses. We don't know what causes it; we don't really know if there is only one disease. We just suffer - and keep pouring our sewage into our water supply.


-- Unknown

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Why would +[initialize] be called twice?
      • From: Bill Bumgarner <email@hidden>
    • Re: Why would +[initialize] be called twice?
      • From: Jean-Daniel Dupas <email@hidden>
    • Re: Why would +[initialize] be called twice?
      • From: Quincey Morris <email@hidden>
    • Re: Why would +[initialize] be called twice?
      • From: Kyle Sluder <email@hidden>
    • Re: Why would +[initialize] be called twice?
      • From: Jonathan del Strother <email@hidden>
  • Prev by Date: Re: Simple array controller master-detail binding problem
  • Next by Date: Re: Why would +[initialize] be called twice?
  • Previous by thread: Re: Create VNC Client iPhone
  • Next by thread: Re: Why would +[initialize] be called twice?
  • Index(es):
    • Date
    • Thread