• 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: awakeFromNib Called Twice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: awakeFromNib Called Twice


  • Subject: Re: awakeFromNib Called Twice
  • From: Bruce Cresanta <email@hidden>
  • Date: Thu, 27 Jan 2011 18:10:12 -0700

Quincey,

	I have an NSDocument instance in my IB!  It was the only way I could hook up a connection to a controlView for the window that gets created for the document.

Do you know a way to programmatically retrieve the controlView for the window that gets created for the document?
This would enable me to forget IB altogether, which is not a problem because I'm using all custom controls written from scratch.

Thanks,

Bruce


On Jan 27, 2011, at 6:05 PM, Quincey Morris wrote:

> On Jan 27, 2011, at 16:43, Bruce Cresanta wrote:
>
>> I have and NSDocument based application with the standard MyDocument document.    I have a view declared as an IBOutlet in the document and use IB to hook up the view variable to the contentView of the window that gets created.    When I put a log message in awakeFromNib, it gets called twice with identical execution traces.    The first time awakeFromNib is called, all the IB connections resolve.    The second time it is called, none of the IB connections resolve and are nil.     Would you please help me think through what's going on?
>
> The most usual cause of this kind of thing is accidentally creating 2 NSDocument objects. For example, when trying to hook up outlets in IB, some developers end up putting a NSDocument object *inside* the NIB. That causes a second document object to be instantiated. (The other is created programmatically by NSDocumentController when you open or create a document.)
>
> Use the debugger to look at the value of 'self' each time you get to 'awakeFromNib'. I bet it's a different value.
>
>

_______________________________________________

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: awakeFromNib Called Twice
      • From: Quincey Morris <email@hidden>
    • Re: awakeFromNib Called Twice
      • From: Kyle Sluder <email@hidden>
    • Re: awakeFromNib Called Twice
      • From: Bruce Cresanta <email@hidden>
References: 
 >awakeFromNib Called Twice (From: Bruce Cresanta <email@hidden>)
 >Re: awakeFromNib Called Twice (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: awakeFromNib Called Twice
  • Next by Date: Re: awakeFromNib Called Twice
  • Previous by thread: Re: awakeFromNib Called Twice
  • Next by thread: Re: awakeFromNib Called Twice
  • Index(es):
    • Date
    • Thread