Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing iOS Dropbox SDK to do a Chunked Upload of Core Data
    primarykey
    data
    text
    <p>I have an iOS app that uses Core Data for persistent data storage. I integrated Dropbox as a way for users to perform a a backup of the persistent store file (appname.sqlite).</p> <p>A UIButton calls a method to see if a file already exists on Dropbox:</p> <pre><code> if([[DBSession sharedSession]isLinked]) { NSString *folderName = [[self.dateFormatter stringFromDate:[NSDate date]] stringByReplacingOccurrencesOfString:@"/" withString:@"-"]; NSString *destinationPath = [NSString stringWithFormat:@"/GradeBook Pro/Backup/%@/",folderName]; self.metadataIndex = METADATA_REQUEST_BACKUP; [self.restClient loadMetadata:destinationPath]; } </code></pre> <p>The loadedMetadata delegate method initiates the upload with the rev number of the existing file (if one exists). </p> <pre><code>-(void) restClient:(DBRestClient *)client loadedMetadata:(DBMetadata *)metadata { SAVE_CORE_DATA; NSString *folderName = [[self.dateFormatter stringFromDate:[NSDate date]] stringByReplacingOccurrencesOfString:@"/" withString:@"-"]; NSString *documentsDirectory = DOCUMENTS_DIRECTORY; NSString *sourcePath = [NSString stringWithFormat:@"%@/GradeBookPro.sqlite", documentsDirectory]; NSString *destinationPath = [NSString stringWithFormat:@"/GradeBook Pro/Backup/%@/",folderName]; [self.restClient uploadFile:@"GradeBookPro.sqlite" toPath:destinationPath withParentRev:[[metadata.contents lastObject]rev] fromPath:sourcePath]; } </code></pre> <p>This works well for reasonably small files or large files over a perfect network connection but any small error during the upload cancels the whole process. I would like to switch to using the chunked upload methods but I'm at a loss as to how to actually do the 'chunking' of the .sqlite file.</p> <p>I can't seem to find any sample apps that are using the chunked upload that I can learn from and the documentation simply says to provide the file in chunks.</p> <p>So, my questions are:</p> <ol> <li><p>Is the chunked upload the right approach to addressing the user issues with uploading large files over a possibly spotty network connection?</p></li> <li><p>Can you point me to sample code / app / documentation for 'chunking' a file? I'm pretty comfortable with the Dropbox SDK.</p></li> </ol> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload