Skip to content

Instantly share code, notes, and snippets.

@tonyarnold
Created January 22, 2011 06:23
Show Gist options
  • Select an option

  • Save tonyarnold/790923 to your computer and use it in GitHub Desktop.

Select an option

Save tonyarnold/790923 to your computer and use it in GitHub Desktop.
Need to migrate your preferences from an existing bundle ID? Use this in your App Delegate.
+ (void)initialize {
// Update the preferences location from the old location (which is now used for the App Store)
NSDictionary *retailUserDefaults = [[NSUserDefaults standardUserDefaults] persistentDomainForName:[NSApp applicationIdentifier]];
if (retailUserDefaults == nil) {
NSDictionary *macAppStoreUserDefaults = [[NSUserDefaults standardUserDefaults] persistentDomainForName:@"com.thecocoabots.hyperspaces"];
for (NSString *key in [macAppStoreUserDefaults allKeys]) {
[[NSUserDefaults standardUserDefaults] setObject:[macAppStoreUserDefaults objectForKey:key] forKey:key];
}
[[NSUserDefaults standardUserDefaults] synchronize];
}
}
@tonyarnold
Copy link
Author

Whoops. Over-release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment