NSData *imageData = UIImagePNGRepresentation(image); //convert image into .png format.
NSFileManager *fileManager1 = [NSFileManager defaultManager];
NSArray *paths1 = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory1 = [paths1 objectAtIndex:0];
NSLog(@"DOC:%@",documentsDirectory1);
documentsDirectory1=[documentsDirectory1 stringByAppendingString:@"/MyFolder"];
[fileManager1 createDirectoryAtPath:documentsDirectory1 attributes:nil];
NSString *fullPath = [documentsDirectory1 stringByAppendingPathC开发者_高级运维omponent:[NSString stringWithFormat:@"/%@%d.png",imagename,j]];
there occur in error
Program received signal: “EXC_BAD_ACCESS”.
warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).
NSString *newFolderPath = [documentsDirectory stringByAppendingPathComponent:@"MyFolder"];
if (![[NSFileManager defaultManager] fileExistsAtPath:newFolderPath])
[[NSFileManager defaultManager] createDirectoryAtPath:newFolderPath withIntermediateDirectories:NO attributes:nil error:&error];
Use this to create directory
精彩评论