• 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
Re: What's up with this....
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's up with this....


  • Subject: Re: What's up with this....
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 22 Mar 2012 09:57:57 -0700

On Mar 22, 2012, at 9:36 AM, Alexandra Beebe wrote:

>> I have a class and in the class I added a "+(void) initialize" that just does a NSLog that it was in the class initialize function.  Now when I include the class in a xib/nib file it works as expected.  My NSLog message shows up.  When I then hook a binding up that uses the class, everything breaks!  My log shows 2 (two) NSLog initialize messages!  Is this the correct list?  Is this a bug?  Is this the correct behavior? Am I missing something?

Does the class have any subclasses? If so, its +initialize will be called again when each subclass is initialized … see the docs on the +initialize method for more details. You should generally structure the method like this:

@implementation Foo

+ (void) initialize {
	if (self == [Foo class]) {  // ignore calls when subclasses are initialized
		NSLog(@“Initializing Foo”);
		…
	}
}

And FYI, the most appropriate list for this kind of question is cocoa-dev. The xcode-users list is for issues with the development tools themselves.

—Jens
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Re: What's up with this.... (From: Alexandra Beebe <email@hidden>)

  • Prev by Date: Re: Xcode-users Digest, Vol 9, Issue 157
  • Next by Date: Re: Xcode-users Digest, Vol 9, Issue 157
  • Previous by thread: Re: What's up with this....
  • Next by thread: Re: What's up with this....
  • Index(es):
    • Date
    • Thread