我使用谷歌雲上傳(https://developers.google.com/storage/docs/json_api/v1/how-tos/upload)API上傳圖像從IOS。谷歌雲存儲JSON上傳API顯示錯誤
我有以下code.For REST經理我使用從這裏https://github.com/SSamanta/SSRestClient
+(void)uploadData:(NSData *)data withName:(NSString *)name onCompletion:(ServiceCompletionHandler)handler {
SSRestManager *restManager = [[SSRestManager alloc] init];
restManager.httpMethod = @"POST";
restManager.contentType = @"image/jpeg";
restManager.contentLength = [NSString stringWithFormat:@"%i",data.length];
restManager.httpBody = data;
NSString *urlString = [NSString stringWithFormat:@"https://www.googleapis.com/upload/storage/v1beta2/b/videosbetas/o?uploadType=media&name=myObject&key=%@",kAPIKey];
[restManager getHttpResponseWithBaseUrl:urlString onCompletion:^(id responseData, NSURLResponse *reponse) {
if (responseData) {
handler (responseData,nil);
}
} onError:^(NSError *error) {
handler(nil,error);
}];
}
我收到下面從谷歌雲存儲API錯誤消息的代碼。我已按照所有說明在Google開發者控制檯中配置應用。
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "accessNotConfigured",
"message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
}
],
"code": 403,
"message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
}
任何人都可以幫助我嗎?
夫婦簡單的問題。首先,你如何認證?其次,在控制檯上,在APIs&auth => APIs下,將「Google Cloud Storage JSON API」設置爲ON或OFF? –
我正在使用API密鑰和oauth2.0兩者。那是在 –