Note that there are some explanatory texts on larger screens.

plurals
  1. PODownload a photo using dropbox iOS SDK
    text
    copied!<p>I need to show users list of all photos in Dropbox and give a possibility to use them (to download in project). Simplify like user pick photo from his photo album. I'm using Dropbox SDK v1.3.3.</p> <p><strong>UPDATE:</strong></p> <p>This is what I done so far:</p> <pre><code>- (void)restClient:(DBRestClient *)client loadedMetadata:(DBMetadata *)metadata { if (metadata.isDirectory) { // Available files extensions NSArray *validExtensions = [NSArray arrayWithObjects:@"jpg", @"jpeg", @"png", nil]; // Local path NSArray *libraryPaths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSString *LibraryDirectory = [libraryPaths objectAtIndex:0]; LibraryDirectory = [LibraryDirectory stringByAppendingString:@"/Dropbox/"]; NSString *localPath = @""; if (![[NSFileManager defaultManager] fileExistsAtPath:LibraryDirectory]){ NSError* error; if( [[NSFileManager defaultManager] createDirectoryAtPath:LibraryDirectory withIntermediateDirectories:NO attributes:nil error:&amp;error]) ;// success else { NSLog(@"[%@] ERROR: attempting to write create Dropbox directory", [self class]); NSAssert( FALSE, @"Failed to create directory maybe out of disk space?"); } } // Work with dropbox files array for (DBMetadata *file in metadata.contents) { NSString* extension = [[file.path pathExtension] lowercaseString]; if(![file isDirectory] &amp;&amp; [validExtensions indexOfObject:extension]!=NSNotFound) { localPath = [LibraryDirectory stringByAppendingPathComponent:[file filename]]; // Add file to Dropbox Directory BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:localPath]; if(!fileExists) [[self restClient] loadFile:file.path intoPath:localPath]; } } } } </code></pre> <p>Just left to show list of photos from Dropbox local folder. Maybe someone know how to do that? I want it to be like from Photo Album:</p> <pre><code>- (void)getDropboxPhotoList:(NSString *)path { UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; /* source must be not from gallery, but from local folder */ //imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; imagePicker.delegate = self; UIPopoverController *pop = [[UIPopoverController alloc] initWithContentViewController:imagePicker]; [pop presentPopoverFromBarButtonItem:(UIBarButtonItem *)dropboxButton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; popover = pop; [imagePicker release]; } </code></pre>
 

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