v1.10 Assert in GDataHTTPUploadFetcher:connectionDidFinishLoading

31 views
Skip to first unread message

Christoph Z.

unread,
Apr 1, 2010, 9:04:48 PM4/1/10
to Google Data APIs Objective-C Client Library Discussion
Hi,

I'm trying to upgrade my project to the latest obj-c client. I get the
following assert when executing the code below:

GDataHTTPUploadFetcher.m:241

NSAssert([[self downloadedData] length] == 0,
@"unexpected response data");


Code that used to work until now:

8< ----

remoteEntry = [GDataEntryStandardDoc documentEntry];

[remoteEntry setTitleWithString:title];
[remoteEntry setUploadData:uploadData];
[remoteEntry setUploadMIMEType:@"text/plain"];
[remoteEntry setUploadSlug:title];

postURL = [[self.syncedFolderFeed postLink] URL];

self.ticket = [self.service fetchEntryByInsertingEntry:remoteEntry
forFeedURL:postURL delegate:self

didFinishSelector:@selector(remoteInsertTicket:finishedWithEntry:error:)];

8< ---

When this code executes, the document does get uploaded correctly and
the server responds with status 201. The response contains the newly
inserted entry (as expected), that's why I don't understand this
assert.

Any ideas?

Thanks,
Christoph

Greg Robbins

unread,
Apr 1, 2010, 9:14:39 PM4/1/10
to gdata-objec...@googlegroups.com
The DocList and YouTube APIs now use chunked uploads. This thread describes the change:


All that needs to change in your code is to upload to the feed's uploadLink rather than the postLink, though you may also want to add support for pausing and resuming uploads, as shown in the DocsSample app.

Greg Robbins

unread,
Apr 1, 2010, 9:23:41 PM4/1/10
to gdata-objec...@googlegroups.com
To avoid reading the whole file into memory, you may also use an NSFileHandle for uploading now, rather than NSData:

NSFileHandle *bigFileHandle = [NSFileHandle fileHandleForReadingAtPath:bigFilePath];
[newEntry setUploadFileHandle:bigFileHandle];


Also, if your application can replace uploaded files, you should change your application's uses of the entry editLink for uploading with the new uploadEditLink.

Christoph Z.

unread,
Apr 1, 2010, 9:47:16 PM4/1/10
to Google Data APIs Objective-C Client Library Discussion
Awesome! Works great!

On Apr 1, 6:14 pm, Greg Robbins <grobb...@google.com> wrote:
> The DocList and YouTube APIs now use chunked uploads. This thread describes
> the change:
>

> http://groups.google.com/group/gdata-objectivec-client/browse_thread/...

Reply all
Reply to author
Forward
0 new messages