This application is working correctly, but now I can’t upload the file or get metadata. Whenever I try to download, I will get
File upload failed with error: Error Domain=dropbox.com Code=401 "The operation couldn’t be completed. (dropbox.com error 401.)"
But when I try to get metadata, I get
Error loading metadata: Error Domain=dropbox.com Code=403 "The operation couldn’t be completed. (dropbox.com error 403.)"
I am trying to re-authenticate, but there seems to be no difference after executing the unlink command. I tried to place this command in different places.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
DBSession *dbSession = [[DBSession alloc]
initWithAppKey:@"**********"
appSecret:@"************"
root:kDBRootDropbox];
[DBSession setSharedSession:dbSession];
[[DBSession sharedSession] unlinkAll];
return YES;
}
It also seems that it does not access the authentication thread stream method:
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url sourceApplication:(NSString *)source annotation:(id)annotation {
if ([[DBSession sharedSession] handleOpenURL:url]) {
if ([[DBSession sharedSession] isLinked]) {
NSLog(@"App linked successfully!");
}
return YES;
}
return NO;
}
I follow the instructions in the Dropbox documentation and cannot find what is wrong.
EDIT: here I call linkFromController inside my ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
self.restClient.delegate = self;
if (![[DBSession sharedSession] isLinked]) {
[[DBSession sharedSession] linkFromController:self];
}
}
Oscar source
share