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

.download image and responseData doesn't work #1818

Closed
ded opened this issue Dec 3, 2016 · 3 comments
Closed

.download image and responseData doesn't work #1818

ded opened this issue Dec 3, 2016 · 3 comments

Comments

@ded
Copy link

ded commented Dec 3, 2016

I copied this verbatim from the main README and it doesn't work (using the following jpeg in the example).

Alamofire.download("https://static.preapp.co/medias/2016/11/10/3194-a7d7afbf22.jpg")
    .downloadProgress { progress in
        print("Download Progress: \(progress.fractionCompleted)")
    }
    .responseData { response in
        // response.result.value  is ALWAYS nil
        if let data = response.result.value {
            let image = UIImage(data: data)
        }
    }
@ded
Copy link
Author

ded commented Dec 3, 2016

Didn't provide this information earlier.
I'm on Swift 3.0, using Xcode 8.1. Alamofire 4.2.0 (cocoapods)

@FaisalAlneela
Copy link

I had the same problem
did you found a solution???

@cnoon
Copy link
Member

cnoon commented Dec 16, 2016

You need to specify the destination closure. Otherwise the file isn't moved out of the temp directory and you don't have access to the data outside of your sandbox after the SessionDelegate API is called. See our README for more info.

I just pushed up ffaa071 which updates the README to hopefully make this more clear.

Cheers. 🍻

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

No branches or pull requests

4 participants