开发者

Im save image in subdirectory but how to retrieve the image using mutable array and they occurs some error

开发者 https://www.devze.com 2023-03-03 16:11 出处:网络
NSData *imageData = UIImagePNGRepresentation(image); //convert image into .png format. NSFileManager *fileManager1 = [NSFileManager defaultManager];
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

0

精彩评论

暂无评论...
验证码 换一张
取 消