Start a new topic
Answered

downloading images from kinvey SWIFT 3

I am trying to download images using the fileId of the image.I am using the download().However the function is not being called.I believe this is because I cannot pass in a fileId parameter in this function.How do I solve this?  (code below)


 let fileStore = FileStore.getInstance()

 let file = File()

 file.fileId = imageId

 fileStore.download(file) { (file, data: Data?, error) in

 if let file = file, let data = data {

 //success

 print("File: \(file)")

 print("Data: \(data.count)")

 } else {

 //fail

 }

 }


Best Answer

Bkwart,


Your earlier reply opened a new ticket on portal. So I am just copying your reply below to complete the loop.


"I got it fixed.Thanks a lot.Using the download method which requires the url solved the problem."


Thanks,

Pranav

Kinvey


Bkwart,

  1. Do you see any compile time or run time error?
  2. What does the error say?
  3. Can you please send a screenshot of the same?

Thanks,
Pranav
Kinvey Support

 

The function does not get called at all.I put a print function to pass a string in the function but it never got called.

In the Kinvey class I am calling this function


 open func download(_ file: Kinvey.File, ttl: Kinvey.TTL? = default, completionHandler: Kinvey.FileStore.FileDataCompletionHandler? = default) -> Request  


which has the comment /// Downloads a file using the `downloadURL` of the `File` instance. 

However, I am not even being able to pass in the downloasURL or fileId parameter. Thanks for the quick reply.

Is anyone at Kinvey willing to help me out on this one?

Hello bkwart,


My apologies that no one has responded to your post on 12/21/16. I will have one of our Swift support specialists look at this and have a response for you ready on Monday.


What version of our iOS SDK are you using? Our latest version for Swift 3 is iOS SDK v3.3.5.


I realize that you think that this function is not being called but I'd like to see if there are any server logs available when you attempt to do this just in case the function is actually called.


Can you reproduce the problem and note the time, date and timezone that you attempted to download the file. The more accurate that you can be the better. It helps us to find the logs more easily. Additionally, if you could share the _id value from the "Files" collection for the file that you tried to download, that will also be helpful. If you're uncomfortable sharing the _id value in this public forum, please send it to my email address below and I will forward it to the support engineer who will work on this issue with you.


We look forward to hearing back from you and again, someone will get back with you on Monday with more information.


Regards,


Billy Gee

billy@kinvey.com

Kinvey, Inc.



Hello bkwart,


Also, you have two apps. Which of them is the one that you are using to reproduce this problem?


Regards,


 

Billy Gee

billy@kinvey.com

Kinvey, Inc.

Answer

Bkwart,


Your earlier reply opened a new ticket on portal. So I am just copying your reply below to complete the loop.


"I got it fixed.Thanks a lot.Using the download method which requires the url solved the problem."


Thanks,

Pranav

Kinvey

Login or Signup to post a comment