printdotio / printio-ios-sdk

SDK that enables the printing of any photo, from any source, onto any product!
Other
20 stars 11 forks source link

Custom PhotoSource does not show image for product. #465

Closed felipessousa closed 9 years ago

felipessousa commented 9 years ago

Hi guys,

When implementing a new PhotoSource for Print.io why the fetchImageForItem method is only called with isThumbnail parameter equals true ? I'm able to see all the thumbnails however the product image is not being downloaded, it shows a loading popup which spins forever. 2015-08-18 19 25 08

override func fetchImageForItem(item: PIOPhotoSourceItem!, thumbnail isThumbnail: Bool, withCompletionHandler imageFetchCompletionHandler: ((UIImage!) -> Void)!) {
        var URLString: String = ""
        let myItem = item as! CustomPhotoSourceItem
        if(isThumbnail){
            URLString = myItem.thumbnailUrl;
        }else{
            URLString = myItem.imageUrl;
        }
        var image: UIImage = UIImage(data: NSData(contentsOfURL: NSURL(string: URLString)!)!)!
        imageFetchCompletionHandler( image );
    }

My class extends PIODefaultPhotoSource

felipessousa commented 9 years ago

It seems that the correct way is implement fetchImageInPhotoSource on CustomPhotoSourceItem and not on CustomPhotoSource.