Youtube Live Streaming API - create live stream is failed with “The request did not specify any iOS bundle ID”

跟風遠走 提交于 2019-12-07 11:57:05

问题


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

Response failed with message:

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

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

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


回答1:


POST Request:

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


来源:https://stackoverflow.com/questions/40043972/youtube-live-streaming-api-create-live-stream-is-failed-with-the-request-did

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!