2013-08-06 76 views
1

我想使用YouTube iOS SDK对playListItems发出请求。iOS YouTube“没有过滤器选择”

我找回了错误...

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的文档是没用,所以没有使用这个例子。我不得不将谷歌购物apis的例子和东西放在一起。

大部分猜测工作来自here

任何想法,我应该在query.q价值?或者如果还有其他东西我错过了?

回答

1

好的,我终于找到了一个链接,在这一点上舍弃了一些链接。

的代码使用是...

query.playlistId = @"the playlist ID"; 

然后一切工作:d