Closed ghost closed 8 years ago
Hi @ChrisOSX this lib won't try to take a screenshot, it uses system SDK to take photo & save it to custom album.
I just tried in iOS 9.2 (13C75), w/o anything wrong. :)
Just took these 2 simulator screenshots of iOS 8.4 and 9.2 to show the comparison.
Can u offer the code snippet u used to save the photo? Including the part like to generate / resize the image.
This is how I'm calling it in my file.
NSURL *imageURL = self.imageInfo.imageURL;
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:imageURL]];
// The completion block to be executed after image taking action process done
void (^completion)(NSURL *, NSError *) = ^(NSURL *assetURL, NSError *error) {
if (error) NSLog(@"!!!ERROR, write the image data to the assets library (camera roll): %@",
[error description]);
NSLog(@"*** URL %@ | %@ || type: %@ ***", assetURL, image, [assetURL class]);
};
void (^failure)(NSError *) = ^(NSError *error) {
if (error == nil) return;
NSLog(@"!!!ERROR, failed to add the asset to the custom photo album: %@", [error description]);
};
[self.assetsLibrary saveImage:image
toAlbum:kKYCustomPhotoAlbumName
completion:completion
failure:failure];
What about the code snippet to generate self.imageInfo
?
I'm using JTSImageViewController. It has quite a few files.
Not sure about it, just checked its demo, seems okay. Can u offer the code snippet u used to generate self.imageInfo
? Any other lib u used related to image taking?
self.imageInfo is generated by that library. It's it own .h and .m files then linked to the other library files.
I don't use any other lib for image taking, other than this one.
My action sheet is triggered by a long press gesture, and one button is for saving, where this library comes into play.
This is how the image gets called in my view controller. The code recognizes a link "example.png", fires the image controller, then ends with the above.
// Create image info
NSURLRequest *request = navigationAction.request;
fileURL = request.URL;
JTSImageInfo *imageInfo = [[JTSImageInfo alloc] init];
imageInfo.imageURL = fileURL;
// Setup view controller
JTSImageViewController *imageViewer = [[JTSImageViewController alloc]
initWithImageInfo:imageInfo
mode:JTSImageViewControllerMode_Image
backgroundStyle:JTSImageViewControllerBackgroundOption_Blurred];
// Present the view controller.
[imageViewer showFromViewController:self transition:JTSImageViewControllerTransition_FromOffscreen];
Seems this part is ok, JTSImageInfo instance just stores image related data. No idea then, sorry, it's hard for me to debug w/o a testing project, i'd glad to offer more help if u can give me a simple demo project that can reproduce the issue (just upload it as ur own repo).
I suggest u do not use two libs (or any other 3rd party lib) at same time first, and test to c which one generates the screenshot actually. e.g., don't use ALAssetsLibrary-CustomPhotoAlbum lib, just save it to normal album to c whether the screenshot still appear.
Btw, have u tried this lib's demo, does the screenshot appear as well in ur device?
Let me know if u're pretty sure it's indeed lead by this lib, thx :)
So with some troubleshooting and using an older version of my project (which uses a different image viewer), I can determine that the new image viewer isn't really to blame, but how I loaded the image and calling the save action. I renamed some things in the save function. did a full clean and such and then tested it out on my device. No screenshot folder.
I had a feeling it was that, but none the less I appreciate the quick feedback and help. This is a awesome library!
@ChrisOSX good, glad to hear that :)
I've been using this library for a while and since I got it working correctly I haven't had any issues.
However, now I'm noticing on iOS 9 (now running WKWebView instead of UIWebView, not sure if that makes a difference), that when I save, it saves to my custom album, camera roll (not a problem as that's supposed to happen), but it saves to a Screenshot folder as well.
Tested in iOS 8 simulator, no screenshot folder.
Is this a iOS 9 issue? Library issue? WKWebView issue?
Thanks for any feedback.