来自此 ios 客户端应用程序 <empty> 的请求被阻止

Bar*_*zyk 5 ios swift google-sheets-api

我尝试使用 Google Sheets API,我这样做:

var service = GTLRSheetsService()
let query = GTLRSheetsQuery_SpreadsheetsValuesGet.query(withSpreadsheetId: SpreadSheetIdentifier, range: SpreadSheetRange)
service.apiKey = SpreadSheetApiKey
service.executeQuery(query, delegate: self, didFinish: #selector(displayResultWithTicket(ticket:finishedWithObject:error:)))
Run Code Online (Sandbox Code Playgroud)

但是当我调用该函数时出现错误:

来自此 ios 客户端应用程序的请求<empty>被阻止。

我错过了什么?

我的谷歌表可以访问任何有链接的人

谷歌的完整回复:

{
  “错误”: {
    “代码”:403,
    "message": "来自这个 ios 客户端应用程序 \u003cempty\u003e 的请求被阻止。",
    "status": "PERMISSION_DENIED",
    “细节”: [
      {
        "@type": "type.googleapis.com/google.rpc.Help",
        “链接”:[
          {
            "description": "Google 开发者控制台 API 密钥",
            "url": "https://console.developers.google.com/project/722884849069/apiui/credential"
          }
        ]
      }
    ]
  }
}