Reputation: 5200
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:
self.dropboxClient
is an instanced DBRestClient
object.photos
is an NSMutableArray of UIImages (I already checked to make sure that the objects are images using the NSStringFromClass() method on each object in the list);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
Reputation: 5200
This was a threading issue. DBRestClient methods, like createFolder
and uploadFile::::
must be executed on the main thread.
Upvotes: 2