0

I'm wondering if there is a possibility if you can create your own folder in NSUserDefaults. Since I'm saving 10 objects in the NSUserDefaults, and I want to easily remove them all I wanted to use a folder, so that all the 10 objects are in the folder and if I want to delete the 10 UserDefaults.

I just need to delete the folder. Is this possible?

Gabriel.Massana
  • 8,165
  • 6
  • 62
  • 81
nonuma
  • 399
  • 1
  • 3
  • 14
  • 1
    You can not create folders inside NSUserDefaults. You can use NSMutableDictionary to save your objects and you can erase it whenever you want to. – Rockey Apr 23 '13 at 10:27

1 Answers1

2

You don't have to make a folder in order to remove all your objects from NSUserDefaults, here's a solution I found here.

NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];
[[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];
Community
  • 1
  • 1
k4dt32o
  • 142
  • 1
  • 9