Frage

I am using google cloud uploader (https://developers.google.com/storage/docs/json_api/v1/how-tos/upload) API to upload image from IOS.

I have below code.For REST Manager I am using code from here 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);
    }];
}

I am receiving below error message from google cloud storage api. I have followed all the instructions to configure app in google developer console.

{
 "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."
 }

Can any one help me?

War es hilfreich?

Lösung

I assume you're using an iOS key. For this particular use case, this is not actually correct. I know using an iOS key for an iOS app seems obviously correct, but oddly it is not.

There's a great answer here that explains what to do: Getting status "REQUEST_DENIED" after fetching data from google places API

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top