Youtube实时流API-创建实时流失败,并显示“请求未指定任何iOS捆绑包ID". [英] Youtube Live Streaming API - create live stream is failed with "The request did not specify any iOS bundle ID"

查看:84
本文介绍了Youtube实时流API-创建实时流失败,并显示“请求未指定任何iOS捆绑包ID".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试发送请求: POST https://www.googleapis.com/youtube/v3/liveStreams

I try to send request: POST https://www.googleapis.com/youtube/v3/liveStreams

响应失败,并显示以下消息:

Response failed with message:

请求未指定任何iOS捆绑包ID.请确保客户端正在发送它,或使用API​​控制台更新您的密钥限制."

"The request did not specify any iOS bundle ID. Please ensure that the client is sending it or use the API Console to update your key restrictions."

我的OAuth 2.0客户端ID(iOS)和Google API管理器上的API密钥具有正确的捆绑软件ID.我发送了key = API_KEY.

My OAuth 2.0 client ID (iOS) and API Key on the Google API Manager have right bundle iD. I send key=API_KEY.

如何将我的商品包ID与请求一起发送?还是我必须做其他事情?

How can I send my bundle id with the request? Or I have to do something else?

推荐答案

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"];

这篇关于Youtube实时流API-创建实时流失败,并显示“请求未指定任何iOS捆绑包ID".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆