We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Chez B.
11 years agoNew member | Level 1
How do I upload a file to my dropbox apps folder in dropbox in objective c?
Currently nothing happens when I run my code.
This is how I am setting the up client. I did not put the client set up in my viewDidLoad method because this class will never be shown it just hand...
Chez B.
11 years agoNew member | Level 1
I have the call back methods implemented in the same class like so.
(void)restClient:(DBRestClient *)client uploadedFile:(NSString *)destPath from:(NSString *)srcPath metadata:(DBMetadata *)metadata {
NSLog(@"File uploaded successfully to path: %@", metadata.path);
}
(void)restClient:(DBRestClient *)client uploadFileFailedWithError:(NSError *)error {
NSLog(@"File upload failed with error: %@", error);
}
Though I have not called them anywhere in the program. I suppose that may not be necessary.
I tried to add the updateAcessToken method inside my didFinishLaunching method like this. I have my actual app key and app secret in my actual code. I just omitted them for security.
DBSession *dbSession = [[DBSession alloc]
initWithAppKey:@"db-myAppKey"
appSecret:@"myAppSecret"
root:kDBRootAppFolder]; // either kDBRootAppFolder or kDBRootDropbox
[dbSession updateAccessToken:@"myAccessToken" accessTokenSecret:@"MyAppsAppSecret" forUserId:[[DBAccountInfo alloc] init].userId];
[DBSession setSharedSession:dbSession];
Xcode gives me the error:
setObjectForKey: key cannot be nil
userID is nil which makes sense. How do I obtain the user ID that is associated with the account that my app was created on without having to bring up a formal dropbox login view when I run the app? I want to be logged into the account that my app was created on, and obtain the userID all in the back end. I don't want the user of the app to have any knowledge that this is going on.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!