我尝试发送请求:文章https://www.googleapis.com/youtube/v3/liveStreams
响应失败,提示:
"请求没有指定任何iOS bundle ID。请确保客户端正在发送它或使用API控制台更新您的密钥限制。"
我的OAuth 2.0客户端ID (iOS)和API Key在Google API Manager上有正确的bundle ID。我发送key=API_KEY.
如何在请求中发送我的bundle id ?还是我得做点别的?
POST请求:
NSURL * url = [NSURL URLWithString:@"https://www.googleapis.com/youtube/v3/liveStreams"];
NSMutableURLRequest * request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
/**
* set access token in HTTP Header field
* get access token after successful login
*/
[request setValue:[NSString stringWithFormat:@"Bearer %@",_str_access_token] forHTTPHeaderField:@"Authorization"];
/**
* set bundle identifier on Header field
*/
[request addValue:[[NSBundle mainBundle] bundleIdentifier] forHTTPHeaderField:@"X-Ios-Bundle-Identifier"];