vendredi 28 novembre 2014

Not retrieving data from image capture


- (void)saveImageToDocumentsDirectory:(int)imageNo :(NSMutableArray *)mimageArray :(imageList *)mimageList
{
NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSDictionary *dict=[mimageArray objectAtIndex:imageNo];
NSString *image1Path;
NSString *imageName;
NSData *data2;

UIImage *image = [UIImage imageNamed:@"imageName"];
data2 = [NSData dataWithData:UIImageJPEGRepresentation(image, 1.0)];
[data2 writeToFile:image1Path atomically:YES];


NSLog(@"THIS IS IMAGE1 DATA: %@",data2);
NSLog(@"THIS IS IMAGENAME: %@",imageName);
NSLog(@"THIS IS IMAGE1 PATH: %@",image1Path);
}


New to Objective C and stuck on this problem where I can't retrieve data from an image I capture.


I'm trying to capture an image from my device's camera and save it to my directory in my application users caches file.


The logs display the correct imageName and image1Path but when I log the data2 I just get <> , so there is no data for the image capture.


I have tried a version where I retrieve and save data from a url to the caches directory and that works but I just can't get it to work with a image captured from my device's camera.




Aucun commentaire:

Enregistrer un commentaire