簡體   English   中英

iOS中的Google API錯誤

[英]Google API Error in ios

我正在嘗試通過Google API獲取用戶信息。 但是我得到了以下錯誤。

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

我的代碼如下:

-(void)get_real_profile:(NSString*)userid
{
    // POST parameters
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://www.googleapis.com/plus/v1/people/%@?key=xxxxxxxxxxxxxxxxx",userid]];
    NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:url];
    [urlRequest setHTTPMethod:@"GET"];
    [urlRequest setValue:userid forHTTPHeaderField:@"userId"];
    [NSURLConnection sendAsynchronousRequest:urlRequest
                                       queue:[NSOperationQueue mainQueue]
                           completionHandler:^(NSURLResponse *response,
                                               NSData *data,
                                               NSError *connectionError) {

                               NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
                               NSLog(@"%@",json);
                           }];
}

我沒有為此應用啟用結算功能。 因此,是否有關於計費被禁用的任何問題。

幫我解決這個問題。

謝謝,

  1. 登錄https://code.google.com/apis/console
  2. 點擊APIs and Auth
  3. 啟用您要訪問的相關API
  4. 確保為您正在從代碼訪問的項目啟用了它。 活動項目顯示在overview鏈接上方

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM