ArtSabintsev
ArtSabintsev

Reputation: 5200

Uploading Image to Dropbox

I'm trying to upload an image to dropbox. I'm using the latest version of the SDK (Sept. 17) and have successfully authenticated my app.

Here's the code that does it:

for ( NSUInteger i = 0; i < [photos count]; i ++ ) {

    NSString *filename = [NSString stringWithFormat:@"%d.png", i+1];
    NSString *file = [NSTemporaryDirectory() stringByAppendingPathComponent:filename];

    [UIImagePNGRepresentation([photos objectAtIndex:i]) writeToFile:file atomically:YES];

    NSString *destDir = @"/";
    [self.dropboxClient uploadFile:filename toPath:destDir withParentRev:nil fromPath:file];

}

Note:

Most importantly, I think there may be an issue with my DBRestClient object (self.dropboxClient), since none of the delegate methods are entered even though I've set the delegate.

Any and all help would be greatly appreciated!

Upvotes: 0

Views: 1075

Answers (1)

ArtSabintsev
ArtSabintsev

Reputation: 5200

This was a threading issue. DBRestClient methods, like createFolder and uploadFile:::: must be executed on the main thread.

Upvotes: 2

Related Questions