【发布时间】:2013-08-06 23:24:41
【问题描述】:
我正在尝试使用 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 Shopping api 和其他东西的示例放在一起。
大部分猜测工作来自here。
我应该在query.q 值中添加什么?或者如果我还缺少其他东西?
【问题讨论】:
标签: ios objective-c youtube