简体   繁体   English

GData Picasa 相册 iPhone

[英]GData Picasa Photo Album iPhone

I was hoping someone could help me with this problem.我希望有人可以帮助我解决这个问题。 I am trying to access a Picasa Web Album from my iphone application.我正在尝试从我的 iphone 应用程序访问 Picasa Web 相册。 I have used GData previously with Google Calendar and getting events and the data related to them before, so I set up my methods in a similar fashion.我之前曾将 GData 与 Google 日历一起使用并获取过事件以及与它们相关的数据,因此我以类似的方式设置了我的方法。 I however am getting an error that is telling me the following但是,我收到一个错误,告诉我以下内容

serviceBase:<GDataServiceGooglePhotos: 0x4d4e6d0> objectFetcher:<GDataHTTPFetcher: 0xbaa35c0> failedWithStatus:400 data:Too many results requested

I am think that I have narrowed down the problem that I am having has something to do with the ticket that I am using, in the following line我认为我已经缩小了与我正在使用的有关的问题,在以下行中

ticket = [service fetchFeedWithURL:[NSURL URLWithString:kGDataGooglePhotosAllFeed]
                          delegate:self
                 didFinishSelector:@selector(photosListTicket:finishedWithFeed:error:)];

I however am unable to get past this problem.然而,我无法解决这个问题。 Does anyone have a suggestion to get past this problem.有没有人有解决这个问题的建议。 Am I doing something wrong?难道我做错了什么?

My full code for the retrieval of the pictures is shown below.我检索图片的完整代码如下所示。 Anywhere that says picAlbum, that is a predefined NSArray to hold the information.任何说 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]]);
}

Thanks in advance for any information or help that you can provide.提前感谢您提供的任何信息或帮助。

If the server says "Too many results requested" that's a clue that the max results query parameter is too big.如果服务器显示“请求的结果太多”,则表明最大结果查询参数太大。

The fetches in the code snippet do not appear functional.代码片段中的提取似乎不起作用。 Neither kGDataGooglePhotosKindAlbum nor an album's alternateLink would be URLs for feeds. kGDataGooglePhotosKindAlbum 和相册的alternateLink 都不是供稿的URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM