M
M
MagoVinch2014-02-28 14:05:07
Objective-C
MagoVinch, 2014-02-28 14:05:07

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];

The code above doesn't work!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question