• 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
Can't restore first responder when restoring window state
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can't restore first responder when restoring window state


  • Subject: Can't restore first responder when restoring window state
  • From: David Catmull <email@hidden>
  • Date: Thu, 16 Feb 2017 11:09:32 -0700

I'm working on using encodeRestorableState/restoreStateWithCoder to save
and restore the state of a window. (I'm doing this manually because I want
to explicitly save my window state in the document and not just rely on the
OS restoring its state as part of restoring the application state.)

The problem I'm having is that when it restores, an error is logged in the
console that it can't restore the first responder because the view in
question has its window set to nil.

I tried calling makeFirstResponder(nil) before encoding, but then the
window is its own first responder and an exception is thrown because it
can't encode itself.

I'm doing this from my window controller's windowDidLoad. Doing it in
awakeFromNib didn't make a difference.

So is there a way I can either prevent the window from saving/restoring the
first responder, or ensure that the first responder view is installed in
the window first?
_______________________________________________

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: Can't restore first responder when restoring window state
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Locale in Watch
  • Next by Date: Re: Can't restore first responder when restoring window state
  • Previous by thread: Locale in Watch
  • Next by thread: Re: Can't restore first responder when restoring window state
  • Index(es):
    • Date
    • Thread