无法从mongolab下载图像[Heroku上的解析服务器]

时间:2016-03-15 03:43:09

标签: mongodb parse-platform mlab parse-server

我使用Heroku上的Parse源代码和Mongodb插件实现了一个简单的instagram克隆应用程序。我在DB上发布了一些图像和消息,当我尝试检索图像及其相应的消息时,我只收到消息,而不是图像。以下是代码和错误:

代码:

  query.findObjectsInBackgroundWithBlock({ (posts, err) -> Void in

               if let posts = posts {

                   for post in posts {

                        self.messages.append(post["message"]! as! String)
                        self.images.append(post["imageFile"]! as! PFFile)
                            self.usernames.append(self.users[post["userId"] as! String]!)
                            self.tableView.reloadData()

                        }
                    }
                })

...

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("postCell", forIndexPath: indexPath) as! instaPostCell

    cell.selectionStyle = UITableViewCellSelectionStyle.None
    images[indexPath.row].getDataInBackgroundWithBlock { (d, error ) -> Void in
        if error == nil {

            if let downloadedImage = UIImage(data: d!) {
                cell.postedImage.image = downloadedImage
            }

       }else {
                if let error = error {
                print("error: \(error.userInfo["error"]!)")
            }
       }


    }

错误: ParseStarterProject-Swift [65068:8486166] [错误]:不支持的URL(代码:100,版本:1.12.0) 错误:不支持的网址

请注意,应用会检索PFFiles,但是当它调用getDataInBackgroundWithBlock时,会有一个"不支持的URL"错误被抛出。此外,客户端代码似乎没问题,因为我测试了连接到原始Parse服务器的客户端应用程序(使用我的教师appId和masterkey),它运行良好。

0 个答案:

没有答案