1 - What is the result of paths, documentsDirectory and getImagePath is correct or not.
2 - Try set the img filename manually (ie : @"1.png") and check if img is loaded correctly
3 - At the other hand, check the file if it exists in documentsDirectory path (also included by project)
NSURL *url = [NSURL fileURLWithPath:path];
Check if file is exists in your documents directory or not
if([[NSFileManager defaultManager] fileExistsAtPath:path])
NSURL *url = [NSURL fileURLWithPath:path];
Also check in your documents directory if the image is getting saved or not. You are given the name of the image like this
image = [UIImage imageNamed:@"1.png"];
so if you are repeating this line your images will be overwritten in documents directory.
You can also put a check here
BOOL success = [data writeToFile:path atomically:YES];
if(success)
NSLog(@"successfully");
else
NSLog(@"failed");