A very basic question concerning dropBox integration into an iPhone app.
I followed the setup of the DropBoxSDK and everything works fine. I can log on to my account and get it linked. So I set up everything correctly.
Now I would like to use it to simply load a file from the dropBox and save it again. Consider that you only want to sync ONE FILE (for the sake of simplicity), called 'example.txt' which is located in the 'Example' folder in my DropBox. The same 'example.txt' is saved locally on the iPhone in the Documents directory of my app.
The dropBox readme file suggest vaguely the following code which I find highly cryptic and can't really see how to load or save a file:
2. Make an request on the rest client:
[[self restClient] loadMetadata:@"/"];
3. Implement the DBRestClientDelegate methods needed to get the results of the
particular call you made:
- (void)restClient:(DBRestClient*)client
loadedMetadata:(DBMetadata*)metadata {
NSLog(@"Loaded metadata!");
}
- (void)restClient:(DBRestClient*)client
metadataUnchangedAtPath:(NSString*)path {
NSLog(@"Metadata unchanged!");
}
- (void)restClient:(DBRestClient*)client
loadMetadataFailedWithError:(NSError*)error {
NSLog(@"Error loading metadata: %@", error);
}
So my (hopefully) simple question is how I can:
- check if there is an example folder in my dropbox
- if not, create one and save the example.txt from app documents into this example folder
- load example.txt
- once programme quits: save example.txt to DropBox
I can't really find an answer to these quite basic steps in the DropBox docs on the website. The example they've provided I find too confusing... especially as it is only about loading files and not saving them as far as I can see.
I'd be grateful for any help or suggestions of how to go about this.