ApplePersistence setting causes stderr logs

Originator:keithbsmiley
Number:rdar://28409008 Date Originated:21-Sep-2016 13:19
Status:Closed (works as expected) Resolved:
Product:macOS Product Version:macOS 10.12 16A323
Classification:Other Bug Reproducible:Always
 
Summary:
If you've ever disabled the ApplePersistence setting on macOS which (at some point) stopped windows from being reopened on restart, there is an log to standard error about its current state. This is quite noisy for command line tools that utilize the parts of AppKit that trigger this log.

Steps to Reproduce:
1. Run: `defaults write NSGlobalDomain ApplePersistence -bool false` (the value can be anything, there just needs to be one)
2. Create a new Swift file with this contents:

```
import AppKit

DispatchQueue.main.async {
    exit(0)
}

NSApplication.shared().run()
```

3. Run the swift file

Expected Results:
There is no output in either stdout or stderr

Actual Results:
This is logged to stderr:

```
2016-09-21 12:55:10.217 swift[56106:179178] ApplePersistence=NO
```

Version:
macOS 10.12 16A323

Notes:
Run: `defaults delete NSGlobalDomain ApplePersistence` to clear this setting and stop this logging.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!