When should User Interface Preservation kick in?

I am trying to get User Interface Preservation working but without luck.


When will the encode functions be called?


I've set isRestorable, restorationClass and identifier properties in my Window but window:willEncodeRestorableState: is never called.


I am expecting it to be called when I quit my application but it is not. Do I have the wrong expectation, or am I doing something wrong? I've followed the steps under "User Interface Preservation" and also this tutorial.