tman 
要回复,请加入论坛
 
3月7日
I have a test case that uploads a photo by calling 
fetchEntryByInsertingEntry. It eventually returns an entry of 
GDataEntryPhoto type which, I assume, is the latest version of entry 
for uploaded photo. Later on, the test case attempts to delete this 
uploaded photo by calling deleteEntry on this entry of GDataEntryPhoto 
type. But deleteEntry call returns 412 status code (data mismatches). 
Exact errors I am getting are below. 

2012-03-06 20:24:00.621 XXXXXX[23164:1a603] -[GDataServiceBase 
objectFetcher:failedWithData:error:] [Line 1059] 
serviceBase:<GDataServiceGooglePhotos: 0xa8dc660> 
objectFetcher:GTMHTTPFetcher 0x14bccc00 (https://photos.googleapis.com/ 
data/entry/api/user/XXXXXXXXX/albumid/5716726739441009857/photoid/ 
5717005949210126098?authkey=Gv1sRgCNeWsIj6usC8jgE
) failedWithStatus: 
412 data:Mismatch: etags = [&quot;YD0qeyI.&quot;], version = [2] 

I am not sure what this error means. I would expect that entry object 
returned by fetchEntryByInsertingEntry would be the most recent entry 
from servers and wouldn't need to be refetched to get the latest 
version. 

Is there any way to work around this error ?
 
 
 
Greg Robbins 
要回复,请加入论坛
 
3月7日
The ETag field of an entry is a hash string indicating the version of the resource on the server. It sounds like the server has changed the photo resource after it was uploaded.
 
 
Try avoiding the ETag check, either by setting the entry's ETag value to nil:
 
  [entry setETag:nil];
 
or by replacing deleteEntry: with deleteResourceURL:ETag: as in:
 
  [service deleteResourceURL:[[entry editLink] URL]
    ETag:kGDataETagWildcard]
    delegate:...
 
 
 
 
tman 
要回复,请加入论坛
 
3月7日
Thanks for your quick reply, Greg! Your suggestion works great. 

On Mar 6, 9:45 pm, Greg Robbins <grobb...@google.com> wrote: 
> The ETag field of an entry is a hash string indicating the version of the 
> resource on the server. It sounds like the server has changed the photo 
> resource after it was uploaded. 
> ETags are described athttp://code.google.com/apis/gdata/docs/2.0/reference.html#ResourceVer... 
- 显示引用文字 -