pierrotsmnrd / grabKit

Drop-in iOS component to easily import photos from Facebook, FlickR, Instagram, Picasa, and more
Other
396 stars 89 forks source link

Cant' load some Facebook pictures URL #58

Open lorenzoPrimi opened 10 years ago

lorenzoPrimi commented 10 years ago

When trying to select a lot of pictures from Facebook I get the photo ID but not the URL, why does it happens?

2014-03-05 17:44:35.972 GrabKitDemo[11781:60b] did select photo : <GRKPhoto: 0x145eacb0 photoId:'10202696807254249' name:'(null)' caption:'Daje de carnava' actual images count:7 > 2014-03-05 17:44:37.798 GrabKitDemo[11781:60b] did finish, selected photos : ( "<GRKPhoto: 0x145eacb0 photoId:'10202696807254249' name:'(null)' caption:'Daje de carnava' actual images count:7 >" ) 2014-03-05 17:44:37.799 GrabKitDemo[11781:60b] the URL of the original image of the first selected photo is : (null) 2014-03-05 17:44:37.800 GrabKitDemo[11781:60b] the size of this image is : 0 x 0

lorenzoPrimi commented 10 years ago

Looks like this problem happens only when there are pictures uploaded with full resolution (_o.png filename) This is the only fix I have found so far, give me some feedback.

I modified those two boolean in GRKFacebookGrabber.m

BOOL sameWidth = ([(NSDecimalNumber*)[rawImage objectForKey:@"width"] compare:originalWidth] == NSOrderedSame || [(NSDecimalNumber*)[rawImage objectForKey:@"width"] compare:originalWidth] == NSOrderedDescending);
BOOL sameHeight = ([(NSDecimalNumber*)[rawImage objectForKey:@"height"] compare:originalHeight] == NSOrderedSame || [(NSDecimalNumber*)[rawImage objectForKey:@"height"] compare:originalHeight] == NSOrderedDescending);
albertoramonj commented 10 years ago

Thanks for the tip. I had this problem two weeks ago. It seems that GRKPhoto originalImage URL attribute is nil sometimes. However, GRKPhoto firstImageWithHeightGreaterThan returns several images with different resolution. So my workaround consisted in getting the biggest image of this list on GRKPickerPhotosList.h collectionView cellForItemAtIndexPath.