Answer the question
In order to leave comments, you need to log in
How to write different arrays in NSUserDefaults that have a different key?
I have a lot of arrays and each has its own number
and I need to write these arrays to NSUserDefaults where the key is the array number.
NSString *idKey = [NSString stringWithFormat:@"%i", number];
NSUserDefaults *list = [NSUserDefaults standardUserDefaults];
[list setObject:[NSKeyedArchiver archivedDataWithRootObject:self.listArray] forKey:idKey];
[lists synchronize];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question