Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Google电子表格API v4-批更新URL不正确_Ios_Swift_Google Sheets Api - Fatal编程技术网

Ios Google电子表格API v4-批更新URL不正确

Ios Google电子表格API v4-批更新URL不正确,ios,swift,google-sheets-api,Ios,Swift,Google Sheets Api,Google Spreadsheets API v4文档似乎列出了一个不正确的URL用于batchUpdate 文件清单如下: POST https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values:batchUpdate 然而,下面的代码 let range = "Sheet1!A\(index):\(index)" let url = String(format:"%@/%@/values:batchUpdate/

Google Spreadsheets API v4文档似乎列出了一个不正确的URL用于batchUpdate

文件清单如下:

POST https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values:batchUpdate
然而,下面的代码

let range = "Sheet1!A\(index):\(index)"
let url = String(format:"%@/%@/values:batchUpdate/%@", baseUrl, spreadsheetId, range)
let params = ["valueInputOption":"RAW"]
let fullUrl = GTLUtilities.URLWithString(url, queryParameters: params)

let body = GTLObject()
body.JSON = ["majorDimension":"ROWS",
            "values": [values]]

driveService.fetchObjectByUpdatingObject(body, forURL: fullUrl, completionHandler: {
    (ticket:GTLServiceTicket!, object:AnyObject!, error:NSError!) in
导致

 <p>The requested URL <code>/v4/spreadsheets/....values:batchUpdate/Sheet1!A4:4?valueInputOption=RAW</code> was not found on this server.  <ins>That’s all we know.</ins>

在此实例中使用的正确URL是什么?

您的URL不正确。文档说明:
https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values:batchUpdate

。。。但是您使用的URL是:
POSThttps://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/:batchUpdate/{range}?{parameters}

在batchUpdate方法中,范围是文章正文的一部分,您提供的每个更新都有一个范围。有关详细信息,请参见示例


上面使用的代码示例似乎是用于普通更新方法,而不是batchUpdate方法。有关更多信息,请参阅上面链接中的其他示例。

…但您的问题是什么?问题很清楚-在本例中使用的正确URL是什么?您是否解决了此问题?我在批量更新时也面临同样的问题