In my UI test I'm trying to force some user defaults. It seems that one can override them with code such as:
var app = XCUIApplication()
app.launchArguments += ["-myUserDefaultKey", "value"]
app.launch()
But I would like to replace the value of a default where the key contains whitespaces, such as the key created automatically when setting NSSplitView.autosaveName = "someSplitView"
, which is NSSplitView Subview Frames someSplitView
. I tried escaping the whitespaces with NSSplitView\\ Subview\\ Frames\\ someSplitView
and putting the key between single or double quotes, but nothing helped. Is this somehow possible?
Also, what would be the preferred way of temporarily removing a user default instead of overwriting it?
I got an answer on the Apple Developer Forums. User defaults with spaces can be used as they are (I hadn't even tried it because I'm so used to having to escape whitespaces in the Terminal):
app.launchArguments += ["-NSSplitView Subview Frames someSplitView", "value"]
Removing user defaults apparently is not possible.