I have an UIImage that is getting captured using the device camera, After the image is captured I am saving the UIImage like this,
-(void)onCapture:(UIImage *)image {
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
NSFileManager *filemanager = [NSFileManager defaultManager];
NSString *pathToImage = [NSTemporaryDirectory() stringByAppendingPathComponent:@"my_photo_001.jpg"];
[filemanager createFileAtPath:pathToImage contents:imageData attributes:nil];
NSURL *imageFileUrl = [NSURL fileURLWithPath:pathToImage];
[self.delegate onDone:imageFileUrl];
}
After the NSURL is passed to the delegate the delegate then passes this NSURL to an image editing view controller, I am passing the UIImage as well as the NSURL to the editing view controller, Once someone is done editing I want to override the UIImage stored at the NSURL with the edited UIImage so I am doing this,
NSData *imageData = UIImageJPEGRepresentation(self.editImage.image, 1.0);
NSString *pathToImage = [pathOfCapturedImage absoluteString];
[imageData writeToFile:pathToImage atomically:YES];
NSURL *imageFileUrl = [NSURL URLWithString:pathToImage];
Where pathOfCapturedImage is the variable I am passing to my edit view controller.
However when I am opening the image after saving it opens up the unedited image, Where am I going wrong?