Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use DKAsset.fetchImageWithSize with iCloud photos (Perhaps?) #58

Closed
mapmyphotos opened this issue Dec 27, 2015 · 8 comments
Closed

Comments

@mapmyphotos
Copy link

Is there a way to disallow the user from seeing and selecting iCloud photos in the photo picker? I've discovered a problem when the user selects a photo from their library that hasn't been downloaded to the device yet. I'm not 100% sure that this means the photo is from iCloud and they are only seeing a small thumbnail preview in the picker.

Below are some scenarios to help you understand how I've determined that the failing photo is from iCloud or some other off-device storage.

Test Case 01:

  1. User picks a photo that hasn't been downloaded to device yet.
  2. Eventually my code will call "fetchImageWithSize" with a bounds of w:1200.0 and h:1200.0
  3. The UIImage that is expected is "nil"

Test Case 02:

  1. First I went to the Photo library outside of my app and found a photo
  2. I zoomed into the photo and noticed a circular loading icon in the bottom right hand corner of the image - I am guessing this means the image is downloading from iCloud???
  3. User opens my app, initiates the DKPicker and selects the same photo from (1 & 2)
  4. My code will call "fetchImageWithSize" with a bounds of w:1200.0 and h:1200.0
  5. The UIImage that is expected is set correctly and is not "nil"

Everything else has been great BTW! Nice work!

@zhangao0086
Copy link
Owner

Hi @eightstrax
Thanks! I've noticed the problem too! And I've solved it in the develop branch :)
Can you help me test that?

pod 'DKImagePickerController', :branch => 'develop'

In the develop branch, autoDownloadWhenAssetIsInCloud is available.

/// If YES, and the requested image is not stored on the local device, the Picker downloads the image from iCloud.
public var autoDownloadWhenAssetIsInCloud = true

@mapmyphotos
Copy link
Author

I updated my Pod file by removing the old reference and added that line with that 'develop' branch, however I'm getting the following error while running "pod install":

[!] Unknown external source parameters for DKImagePickerController: {:branch=>"develop"}

@mapmyphotos
Copy link
Author

Hey, I fixed the pod issue by using this pod line instead:

pod 'DKImagePickerController', :git => 'https:/zhangao0086/DKImagePickerController.git' , :branch => 'develop'

@zhangao0086
Copy link
Owner

Oh! Sorry, It's my fault!
Thanks for the correction!

@mapmyphotos
Copy link
Author

Now I cannot build my Project....

image

@zhangao0086
Copy link
Owner

Fixed. Please pod update.

@mapmyphotos
Copy link
Author

Yes, it works now. Great work!

Important to note to others after doing this:

Had to change the call to DKAsset (Asset) in my code from:

Asset.fetchImageWithSize(CGSize(width:1200.0, height:1200.0), completeBlock: {
            (image: UIImage?) -> Void in
....
....
})

to

Asset.fetchImageWithSize(CGSize(width:1200.0, height:1200.0), completeBlock: {
            (image: UIImage?, info: [NSObject: AnyObject]?) -> Void in
....
....
})

@zhangao0086
Copy link
Owner

@eightstrax
Thanks for all your testing!!! I'll update the demo project and release it in v3.0.4 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants