【发布时间】:2014-05-19 09:42:57
【问题描述】:
我的应用程序在 appdata 文件夹中保留了一些特定于应用程序的文件。但是,当文件尝试更新 Drive 应用程序数据中的文件时,会反复从 Drive 服务器收到内部错误。我正在使用 Objective-c 客户端来调用 Drive API。
你能帮忙看看这些有什么问题吗?至少给出一些建议来找出这个错误的原因。
以下是记录的请求和响应:
drive.files.update (bytes 0-40318/40319)
2014-05-19 09:23:44 +0000
Request: PUT https://www.googleapis.com/upload/rpc?uploadType=resumable&prettyPrint=false&upload_id=AEnB2Uo8yrae46aQQ-HYEtQgmXt2qNppZmkBYnPa8iXF4L6xdNYaVij6u3xLTT5kRIeH1mbPUUfUuEDEvYoouZheVwwWT6iw_A
Request headers:
Content-Length: 40319
Content-Range: bytes 0-40318/40319
Content-Type: binary/octet-stream
User-Agent: com.mycompanyname.appname/1.4.0 google-api-objc-client/2.0 MacOSX/10.8.5 (gzip)
Request body: (40319 bytes)
<<40319 bytes>>
Response: status 200
Response headers:
Alternate-Protocol: 443:quic
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Length: 144
Content-Type: application/json; charset=UTF-8
Date: Mon, 19 May 2014 09:23:44 GMT
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Pragma: no-cache
Server: HTTP Upload Server Built on May 15 2014 11:06:48 (1400177208)
Response body: (144 bytes)
{
"error" : {
"message" : "Internal Error",
"data" : [
{
"reason" : "internalError",
"message" : "Internal Error",
"domain" : "global"
}
],
"code" : 500
},
"id" : "gtl_20"
}
------------------------------------------------------------ ------------
更新
Jon Skeet from:answer to this question提出的一个很好的解决方法
我已经设法重现了这个问题。没有 setNewRevision(false) 它 有效 - 我意识到这可能并非在所有情况下都可行,但它是 目前对您来说合理的解决方法?
但是,我现在将保留这种解决方法。我们更喜欢setNewRevision(false),以防止导致用户数据存储配额的使用增加 - http://developers.google.com/drive/v2/reference/files/update
【问题讨论】:
-
Jon Skeet 的建议 - stackoverflow.com/a/23742537/72437
-
@CheokYanCheng Temporary 给了我暂时的安慰。谢谢。
标签: objective-c google-drive-api