MHVideoPhotoGallery
MHVideoPhotoGallery copied to clipboard
Crash during image saving to camera roll
If gallery item was created with itemWithImage gallery crashes when user tries to save image to camera roll. This happens here in saveImages method of MHShareViewController classs
[self getAllImagesForSelectedRows:^(NSArray *images) {
for (MHImageURL *dataURL in images) {
if ([dataURL.image isKindOfClass:[UIImage class]]) {
images array contains UIImage and dataURL.image crashes everything
Crash logs:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage image]: unrecognized selector sent to instance 0x7fcb688d9fa0' *** First throw call stack: ( 0 CoreFoundation 0x0000000102124f35 exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010572fbb7 objc_exception_throw + 45 2 CoreFoundation 0x000000010212c04d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x000000010208427c __forwarding + 988 4 CoreFoundation 0x0000000102083e18 _CF_forwarding_prep_0 + 120 5 XX 0x000000010093da0d __36-[MHShareViewController saveImages:]_block_invoke + 381 6 XX 0x0000000100937cb3 __40-[MHShareViewController setSaveCounter:]_block_invoke + 531 7 libdispatch.dylib 0x0000000105b09ba6 _dispatch_call_block_and_release + 12 8 libdispatch.dylib 0x0000000105b277f4 _dispatch_client_callout + 8 9 libdispatch.dylib 0x0000000105b108fb _dispatch_main_queue_callback_4CF + 949 10 CoreFoundation 0x000000010208cfe9 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 11 CoreFoundation 0x000000010204feeb __CFRunLoopRun + 2043 12 CoreFoundation 0x000000010204f486 CFRunLoopRunSpecific + 470 13 GraphicsServices 0x00000001069179f0 GSEventRunModal + 161 14 UIKit 0x0000000104472420 UIApplicationMain + 1282 15 XX 0x0000000100643a63 main + 115 16 libdyld.dylib 0x0000000105b5c145 start + 1 17 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException
Bypassed a problem creating gallery item with [MHGalleryItem itemWithURL: galleryType:]
That will not work for me because my images are from core data.
you can try to save images in to temp dir before open in gallery.
I am going to fix this next week guys.
Hello @mariohahn, Thanks for this library Do you have any news concerning this issue?
I use your library in a Messaging app, i already use SDWebimage to download and Cache images previously in the app. When I tap on the image to enlarge it, i use your browser but i dont want to reload the image through your library. So i can find the image in my SD Cache and just display it through [MHGalleryItem itemWithImage:], but there is this share issue...
Thanks for your help
I encountered the same problem today. I think the problem is that an MHImageURL instance is not created when the MHGalleryItem is instantiated with itemWithImage
I suggest to make the following change to fix this problem: Line 876 of file
MHShareViewController.m
MHImageURL *imageURLMH = [MHImageURL.alloc initWithURL:item.URLString
image:item.image];
[weakSelf addDataToDownloadArray:imageURLMH];
Thanks!