I'm storing all my data in NSUserDefaults. Now I'm trying to store some keys with a specific prefix in an Array. Therefore, I first load the UserDefaults in a Dictionary.
NSString *myPrefix = @"prefix";
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *dict = [defaults dictionaryRepresentation];
for (NSString *keyWithPrefix in dict.keyEnumerator) {
if ([keyWithPrefix hasPrefix: myPrefix]) {
[relevantKeys addObject: keyWithPrefix];
}
}
The Problem is: when I print "dict" (which represents UserDefaults). There are some keys missing. Does NSUserDefaults delete keys, that are not needed temporarily?