Removing UserDefaults when Archiving

LS,


I am archiving an app to distribute outside the MacAppStore. All the app does is ask for an URL when launching the application for the first time.


For some reason, the UserDefaults seem to be exported as well ( and the URL for testing comes along with the app ). I come to this conclusion because when I open the app on a virgin Mac it acts according to the UserDefaults I tested my app in Xcode with. ( and thus opens the URL ).


My question: how do I get rid of those UserDefaults when archiving?

For some reason, the UserDefaults seem to be exported as well …

That is definitely not the case. I’m not sure what’s going on with your app but app archives do not contain a snapshot of your current user defaults.

There’s a few things you can do to investigate this:

  • Make sure you log in as a new user; these days user defaults can be synced via iCloud.

  • The

    defaults
    lets you read and write user defaults from Terminal. You could run this to confirm that the value is not in the user defaults database.
  • You should look for calls to

    -registerDefaults:
    , which is a common way for apps to register there default user defaults.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Removing UserDefaults when Archiving
 
 
Q