Question

I have a simple free app which I am trying to allow users of the application to backup their data to Dropbox for safe keeping.

This all works just fine until I unlink the account and then relink the account. Then my next call fails.

Here is the calls that are made:

- (IBAction)linkToDropBox:(id)sender {
    if (![[DBSession sharedSession] isLinked]) {
        [[DBSession sharedSession] linkFromController:self];
    }
    [self checkForBackups];
}

- (void) checkForBackups {
    //Determine if backup exists
    if ([[DBSession sharedSession] isLinked]) {
        [self.restClient loadMetadata:@"/"];
    }
}

The first time this is execute it works with no issues, however when I first unlink by calling [[DBSession sharedSession] unlinkAll]; and then call link toDropBox the linking is successful, the loadMetada fails.

2014-03-26 13:01:24.065 appName[3519:60b] App linked successfully!

2014-03-26 13:01:24.626 appName[3519:60b] [WARNING] DropboxSDK: error making request to /1/metadata/sandbox - (403) Parameter not found: oauth_token

2014-03-26 13:01:24.628 appName[3519:60b] Error loading metadata: Error Domain=dropbox.com Code=403 "The operation couldn’t be completed. (dropbox.com error 403.)" UserInfo=0xb900290 {path=/, error=Parameter not found: oauth_token}

If I then close my view and open it again, it works. Seems that for some reason the call needs the view to reload?

I am unsure as to what is happening here? Any help on direction to solve this issue would be greatly appreciated.

Thanks.

Was it helpful?

Solution

The issue was a simple one.

I needed to move these calls:

self.restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
self.restClient.delegate = self;

From -(void)viewDidLoad to -(void)viewDidAppear

Since the restClient was set only on the creation of the view, it never was reset.

Thanks Greg - this helped!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top