我正在尝试使用 YouTube iOS SDK 发出对 playListItems 的请求。
我返回一个错误...
Error Domain=com.google.GTLJSONRPCErrorDomain
Code=-32602 "The operation couldn’t be completed. (No filter selected.)"
UserInfo=0x1568f1e0
{
error=No filter selected.,
GTLStructuredError=GTLErrorObject 0x1567fdf0: {message:"No filter selected." code:-32602 data:[1]},
NSLocalizedFailureReason=(No filter selected.)
}
我正在使用的查询是这样的...
GTLServiceYouTube *service = [[GTLServiceYouTube alloc] init];
service.APIKey = @"my key";
// I suspect the problem is here...
GTLQueryYouTube *query = [GTLQueryYouTube queryForPlaylistItemsListWithPart:@"contentDetails"];
query.q = @"playlistId=<The playlist ID>";
GTLServiceTicket *ticket = [service executeQuery:query
completionHandler:^(GTLServiceTicket *ticket, id object, NSError *error) {
if (!error) {
GTLYouTubePlaylistItemListResponse *playlistItems = object;
for (GTLYouTubePlaylistItem *playlistItem in playlistItems) {
GTLYouTubePlaylistItemContentDetails *details = playlistItem.contentDetails;
NSLog(@"PlaylistItem video ID = %@", details.videoId);
}
} else {
NSLog(@"%@", error);
}
}];
问题是整个 API 的文档都是无用的,所以没有使用它的例子。我必须从 Google 购物 API 和其他东西的示例中将其组合在一起。
大部分猜测工作来自here .
我应该在 query.q
值中放入什么?或者我是否还缺少其他东西?
最佳答案
好的,我终于找到了一个链接,其中包含一些链接。
要使用的代码是...
query.playlistId = @"the playlist ID";
然后一切正常:D
关于iOS YouTube "No Filters Selected",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18092161/