Great, thank you again. I now have most of this working with one thing I still haven't managed:
- If DBFILESUploadSessionFinishBatchResultEntry results in -isFailure, how do I get the path the entry was trying to upload to? If there's a failure, I check the reasons and try re-uploading if possible. But in order to do that, I need the upload path so that I can retrieve information about the local file I was trying to upload and try again.
This isn't a problem with the non-batch methods, because the completion handlers have access to the path or information you passed into the calling methods. And in API 1's -restClient: uploadFromUploadIdFailedWithError: method, you could get the upload path from the "destPath" key of the NSError's userInfo dictionary.
I can't find a way of retrieving this information in API 2's batch checks, however. DBFILESUploadSessionFinishBatchResultEntry only provides failure (DBFILESUploadSessionFinishError) and success (meta-data) objects. The meta-data object isn't available in the case of a failure. And DBFILESUploadSessionFinishError provides no access to the path, nor do any of the properties on it.
Given that the upload path is vital information if a DBFILESUploadSessionFinishBatchResultEntry entry results in failure, I assume there must be some way of retrieving it, so could you please tell me what I'm missing?
i.e.:
DBRpcTask *checkTask = [self.dropboxClient.filesRoutes uploadSessionFinishBatchCheck:asyncJobId];
[self.dropboxClient.filesRoutes response:^(DBFILESUploadSessionFinishBatchJobStatus *status, DBASYNCPollError *pollError, DBError *dbError){
if (status)
{
if (status.isComplete)
{
// Go through results.
for (DBFILESUploadSessionFinishBatchResultEntry *result in status.complete.entries)
{
if (result.isSuccess)
{
DBFILESFileMetadata *metaData = result.success;
// Do something (e.g. ensure local date and meta-data date are the same).
}
}
else if (result.isFailure)
{
DBFILESUploadSessionFinishError *error = result.failure;
// How do I find exactly which file failed to upload? What is the path
// on Dropbox that did not get uploaded?
}
}
}
else // if (status.isInProgress)
{
// Call this method to poll again after a delay.
}
}
else // Error!
{
// Handle errors.
}
}];
(Alternatively, the sessionID associated with the chunked upload would be fine if I could retrieve that from the error, because I could record that against the file I was uploading at the start of the upload and then use it to look up the file on failure. Basically, I just need some information from the failure error that I can use to look up what exactly has failed.)
Thanks!
Keith
P.S. I tried posting this twice as a reply to the other thread about uploading chunks, but each time I submitted, it failed to show up on the forum.