Start a new topic

Connection to Google Cloud Storage

I am trying to establish a connection to Google Cloud Storage from my xcode swift files. I stored all my data in GCS, but don't know how to access it through Kinvey. I tried the following code sample (in Swift), but it doesn't really work. Perhaps I need to set up a data link? Hopefully someone can help me out on this one. Thanks a ton.


//Downloads files from Kinvey and Google Cloud Storage
            completionBlock: { (downloadedResources: [AnyObject]!, error: NSError!) -> Void in
                if error == nil {
                    let file = downloadedResources[0] as! KCSFile
                    let fileData =
                    var outputObject: NSObject! = nil
                    if file.mimeType.hasPrefix("text") {
                        outputObject = NSString(data: fileData, encoding: NSUTF8StringEncoding)
                    } else if file.mimeType.hasPrefix("image") {
                        outputObject = UIImage(data: fileData)
                    NSLog("downloaded: %@", outputObject)
                } else {
                    NSLog("Got an error: %@", error)
            progressBlock: nil



Can you explain what you mean here by "doesn't really work"?   What is it that you're trying to do?   How is it failing?


I want to download images to my xcode project. The images are stored in Google Cloud Storage. The Code above doesn't do the job and does not return anything.

Can you clarify what you mean "download images to my xcode project?   Do you mean you want to use them in your code or in your project itself.)

Login or Signup to post a comment