【问题标题】:Could not upload image using Parse Server无法使用 Parse Server 上传图像
【发布时间】:2016-02-15 12:26:59
【问题描述】:

我已经使用 Parse 很长时间了。今天我在本地安装了 Parse Server(使用从 heroku 克隆的 repo 并在本地使用 mongoDB),并尝试上传图像。我用来上传图片的 Swift 代码。

  let testObject = PFObject(className: "Test")
        testObject["foo"] = "bar"

        if let imageData = UIImagePNGRepresentation(UIImage(named: "1")!)
        {
            testObject["image"] = PFFile(data: imageData)
        }

        testObject.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in

            if let properError = error
            {
                print(properError)
            }
            else
            {
                print("Object has been saved.")
            }
        }

我收到此错误消息。

[Error]: Could not store file. (Code: 130, Version: 1.12.0)
Error Domain=Parse Code=130 "Could not store file." UserInfo={code=130, temporary=0, error=Could not store file., NSLocalizedDescription=Could not store file.}

之后,我尝试通过更改应用程序中的一些设置将图像上传到 Parse.com。通过使用相同的代码将图像上传到服务器。 然后我收到了这个错误信息。

 [Error]: Could not store file. (Code: 130, Version: 1.12.0)
    Error Domain=Parse Code=130 "invalid file upload" UserInfo={code=130, temporary=0, error=Could not store file., NSLocalizedDescription=invalid file upload.}

之后我在 Heroku 上安装 Parse Server 并连接 MongoLabs,并尝试使用相同的代码上传相同的文件,我收到错误消息说“Internet 连接似乎已脱机”。当有适当的互联网连接时。

之后,我尝试将一个非常小的图像上传到 Heroku 中托管的同一个 Parse Server,然后它就可以工作了。该文件已上传并在 MongoLabs 中。我看到该文件以名称“hashValue_file_bin”保存。

我在项目目录中寻找这个文件,但看不到它。我在哪里可以看到这些文件?他们是直接上传到数据库还是使用目录结构。

另外请帮我看看为什么这个上传不起作用?

【问题讨论】:

    标签: ios swift mongodb heroku parse-platform


    【解决方案1】:

    我相信这会回答你的问题

    issue #136

    简而言之,这将在大约 2 天前修复,并将在 v2.1.3 中

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-11
      • 1970-01-01
      • 2018-07-04
      相关资源
      最近更新 更多