This is Cocoa auto recovery in action. You can disable it when your application starts under Xcode by editing the active scheme, selecting the βRunβ action and checking βRun the application without restoring stateβ.

Note. Disabling this will also disable the automatic reopening of documents that were previously opened, which can be a pain for testing a document-based application, as you will have to re-open the document manually each time it starts. It also only disables runtime recovery under Xcode under this particular scheme.
source share