How to store image in program (not in photo library)
I what to store images with below code but occur error,How should i store images(not in photo library in program like this method)?
NSMutableArray *array=[[NSMutableArray alloc]init]; [array addObject:[UIImage imageNamed:@"a"]]; [array addObject:[UIImage imageNamed:@"b"]]; NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES); NSString *documentsDirectory = [path objectAtIndex:0]; NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:@"SaveCartoons"]; NSMutableDictionary *dict = [[NSMutableDictionary alloc]init]; [dict setObject:array forKey:@"1"]; [NSKeyedArchiver archiveRootObject:dict toFile:fullPath];
The code up there is likely not to save.
For starters, UIImage is not something that can be easily archived.
Look at the answer to this question and convert your UIImage to NSData and then you can add that to your mutable array.