我用以下代码存储图像但发生错误,我应该如何存储图像(不是像这种方法那样在程序中的照片库中)?
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];
答案 0 :(得分:1)