code on Pastie,gist
- (GDataEntryContact *)uploadPhotoWithContactService:(GDataServiceGoogleContact *)contactService contact:(GDataEntryContact *)targetContact photoData:(NSData *)photoData { GDataEntryBase *uploadPhotoEntry = [GDataEntryBase entry]; // file path on iOS don't need NSString *mimeType = [GDataUtilities MIMETypeForFileAtPath:nil defaultMIMEType:@"image/*"]; [uploadPhotoEntry setUploadMIMEType:mimeType]; [uploadPhotoEntry setUploadData:photoData]; // |setShouldUploadDataOnly| will only upload data without entry data [uploadPhotoEntry setShouldUploadDataOnly:YES]; NSURL *postURL = [[targetContact photoLink] URL]; __block GDataEntryContact *newContactEntry = nil; __block NSError *newError = nil; [contactService fetchEntryByUpdatingEntry:uploadPhotoEntry forEntryURL:postURL completionHandler:^(GDataServiceTicket *ticket, GDataEntryBase *entry, NSError *error) { newContactEntry = (GDataEntryContact *)entry; newError = error; }]; return newContactEntry; }