I don't get it with the Dropbox API.
I got an app with CoreData. The user can choose if he wants to upload the SQlite file to Dropbox. So i made a settings tab where he can de-/activate the Dropbox sync and enter Dropbox username and password. (Yes, I know that Dropbox doesn't want to store the password).
The SQLite file should be uploaded, if the user changes anything. So I don't need an ViewController for Dropbox functions.
What I want is something like a DropboxHelper class (NSObject), with a function like
+ (void)uploadFile;
In my Dropbox account, I created an App. The App Key and App Secret I use in my AppDelegate:
DBSession* session = [[[DBSession alloc] initWithConsumerKey:@"KEY"consumerSecret:@"SECRET"]autorelease]; <br>
[DBSession setSharedSession:session];
[session release];
For the upload I need a DBRestClient. In my upload function I test if the session is linked. If not, login the user:
if (![[DBSession sharedSession]isLinked]) {
[self.restClient loginWithEmail:@"USERNAME"
password:@"PASSWORD";
}
But the session is always linked?! And I have to init the DBRestClient like this:
restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
So what I don't get:
I need the APP KEY and APP SECRET to use the API (so its the API Key)?
How do I login the User if the session is already linked? (I don't want to use the DBLoginController for login)
If I don't init the session in AppDelegate, how can I init the DBRestClient with a session?
Is it generally possible to use the API like this? Without a Viewcontroller and use NSObject instead?