我希望有人可以帮我解决这个问题。我正在尝试从我的iphone应用程序访问Picasa网络相册。我之前使用GData和Google Calendar并获取事件和与之相关的数据,因此我以类似的方式设置了我的方法。然而,我收到的错误告诉我以下
serviceBase:<GDataServiceGooglePhotos: 0x4d4e6d0> objectFetcher:<GDataHTTPFetcher: 0xbaa35c0> failedWithStatus:400 data:Too many results requested
我认为我已经缩小了与我正在使用的故障单有关的问题,在以下行中
ticket = [service fetchFeedWithURL:[NSURL URLWithString:kGDataGooglePhotosAllFeed]
delegate:self
didFinishSelector:@selector(photosListTicket:finishedWithFeed:error:)];
但是我无法解决这个问题。有没有人建议解决这个问题。难道我做错了什么?
我的完整代码检索如下所示。说picAlbum的任何地方,这是一个预定义的NSArray来保存信息。
- (GDataServiceGooglePhotos *)photoService {
static GDataServiceGooglePhotos* service = nil;
if (!service) {
service = [[GDataServiceGooglePhotos alloc] init];
[service setShouldCacheDatedData:YES];
[service setServiceShouldFollowNextLinks:YES];
}
[service setUserCredentialsWithUsername:@"username"
password:@"password"];
return service;
}
-(void)loadGooglePhotos {
[self fetchAllPhotos];
}
-(void)fetchAllPhotos {
NSLog(@"In fetchAllPhotos");
GDataServiceGooglePhotos *service = [self photoService];
GDataServiceTicket *ticket;
ticket = [service fetchFeedWithURL:[NSURL URLWithString:kGDataGooglePhotosKindAlbum]
delegate:self
didFinishSelector:@selector(photosListTicket:finishedWithFeed:error:)];
}
- (void)photosListTicket:(GDataServiceTicket *)ticket finishedWithFeed:(GDataFeedPhotoAlbum *)feed error:(NSError *)error {
NSLog(@"In photosListTicket");
NSArray *photos = [feed entries];
if ([photos count] != 0){
self.picAlbum = [photos objectAtIndex:0];
NSLog(@"fetching photos");
[self fetchPhotos];
}
else {
NSLog(@"User has no photos...");
}
}
- (void)fetchPhotos {
NSLog(@"In fetchPhotos");
if (self.picAlbum) {
NSURL *feedURL = [[self.picAlbum alternateLink] URL];
if (feedURL) {
NSLog(feedURL);
GDataQueryGooglePhotos *query = [GDataQueryGooglePhotos photoQueryWithFeedURL:feedURL];
[query setMaxResults:1000];
GDataServiceGooglePhotos *service = [self photoService];
GDataServiceTicket *ticket;
ticket = [service fetchFeedWithQuery:query delegate:self didFinishSelector:@selector(photosEventsTicket:finishedWithFeed:error:)];
}
}
}
- (void)photosEventsTicket:(GDataServiceTicket *)ticket finishedWithFeed:(GDataFeedPhotoAlbum *)feed error:(NSError *)error {
NSLog(@"In photosEventsTicket");
NSArray *photos = [feed entries];
NSLog([NSString stringWithFormat:@"%i",[photos count]]);
}
提前感谢您提供的任何信息或帮助。
答案 0 :(得分:0)
如果服务器显示“请求的结果太多”,则表明最大结果查询参数太大。
代码段中的提取功能似乎不起作用。 kGDataGooglePhotosKindAlbum和相册的alternateLink都不是Feed的网址。