GData Picasa 相册 iPhone

发布于 2024-11-24 17:12:54 字数 2909 浏览 2 评论 0原文

我希望有人能帮助我解决这个问题。我正在尝试从我的 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]]);
}

预先感谢您提供的任何信息或帮助。

I was hoping someone could help me with this problem. I am trying to access a Picasa Web Album from my iphone application. 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. 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.

- (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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

要走干脆点 2024-12-01 17:12:54

如果服务器说“请求的结果太多”,则表明最大结果查询参数太大。

代码片段中的提取似乎不起作用。 kGDataGooglePhotosKindAlbum 和相册的alternateLink 都不是提要的URL。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文