I am trying to store an NSMutableArray of images using persistive storage but it is not storing it
here is my code
[imagingList addObject:image ]; //image is of type UIImage
imagingHistory=[NSUserDefaults standardUserDefaults];
[imagingHistory setObject:imagingList forKey:@"imaging history" ];
and in my view did load I write
imagingList = [[NSUserDefaults standardUserDefaults] mutableArrayValueForKey:@"imaging history" ];
when I re-load the application the list of objects is set back to Zero
am I missing something ?
You can’t save a UIImage directly in the user defaults. You have to convert it to an NSData first. Just by chance, when I was looking for the NSUserDefaults reference page to answer this question, a found a tutorial on how to do exactly what you want.