从 youtube api 加载数据时出错

Errors in loading data from youtube's api

我正在我的移动应用程序中使用 youtube api,但它无法正常工作。 一旦我创建了 iOS 密钥,我尝试了它并弹出了一个错误:

There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.

然后我读到了它,结果证明我可以通过创建一个没有引荐来源网址的浏览器密钥来解决它,所以这会起作用。

在我这样做之后,我试过了,但弹出了这个错误:

"domain": "usageLimits", "reason": "keyExpired", "message": "Bad Request"

我能做什么???请帮忙。

谢谢

EDIT :当我在 google chrome 上尝试 url 时,它突然无处不在,但在我的应用程序中当我使用 NSJSONSerialization 时,它 returns 一个空结果并出现此错误:

Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Something looked like a 'true' but wasn't around character 0.) {NSDebugDescription=Something looked like a 'true' but wasn't around character 0.}

即使数据不为空。

成功了:

第一个错误本身就起作用了,实际上我什么也没改变。 另一个错误是通过像这样将数据附加在一起来解决的:

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    [_dataResponse appendData:data];
}

并使用 dataResponse