GTMHTTPFetcher Gmail联系人照片返回状态503(有时)

时间:2015-04-20 06:05:39

标签: ios objective-c gdata gmail-api

我正在使用gdata来获取app用户的gmail联系人照片,正是以下代码。但有时候抓取工作,有时它没有,并给我以下错误:(我怀疑太多令牌给谷歌服务器?虽然我还不太熟悉这个概念。但我确实需要取得所有用户联系照片,有办法解决它吗?)

提前谢谢你,

imageFetcher:GTMHTTPFetcher 0x145ea3300(https://www.google.com/m8/feeds/photos/media/XXXXX%40gmail.com/XXXXX)failedWithError:Error Domain = com.google.HTTPStatus Code = 503“无法完成操作。(com.google.HTTPStatus错误503。)”

if ([[[contact photoLink] ETag] length] ) {
                // imageData = [NSData dataWithContentsOfURL:photoURL];
                // requestForURL:ETag:httpMethod: sets the user agent header of the
                // request and, when using ClientLogin, adds the authorization header
                // get an NSURLRequest object with an auth token

                self.flyingtoken ++;
                NSURL *imageURL = [[contact photoLink] URL];
                GDataServiceGoogleContact *service = [self contactService];

                // requestForURL:ETag:httpMethod: sets the user agent header of the
                // request and, when using ClientLogin, adds the authorization header
                NSMutableURLRequest *request = [service requestForURL:imageURL
                                                                 ETag:nil
                                                           httpMethod:nil];

                [request setValue:@"image/*" forHTTPHeaderField:@"Accept"];

                GTMHTTPFetcher *fetcher = [GTMHTTPFetcher fetcherWithRequest:request];
                [fetcher setAuthorizer:[service authorizer]];
                [fetcher beginFetchWithDelegate:self
                              didFinishSelector:@selector(imageFetcher:finishedWithData:error:)];

            }

2 个答案:

答案 0 :(得分:0)

以下是SGC的答案: 谷歌服务器通常会返回503错误,表明您的配额已超出。尝试实施exponential back off off developers.google.com/api-client-library/java/...

答案 1 :(得分:0)

503错误通常由Google服务器返回,表明您的配额已超出。尝试实施exponential back off off developers.google.com/api-client-library/java/...