I'm adding Dropbox to my app using the SDK available on their site. Is there any way of calling some method once [[DBSession sharedSession] linkFromController:self];
links with an account?
Basically I'd like to call [self.tableView reloadData]
once the app has tried to log in to Dropbox. It doesn't even need to discriminate between a successful or unsuccessful login.
The Dropbox SDK uses your AppDelegate as callback reciever. So when you have called
[[DBSession sharedSession] linkFromController:self];
the Dropbox SDK will in any case call your AppDelegate's– application:openURL:sourceApplication:annotation:
method.So within the AppDelegate you can check by
[[DBSession sharedSession] isLinked]
if the login was successful or not. Unfortunately there is not callback for your viewController, so you have to notify it by other means (direct reference or post a notification).This rather strange way of calling the app back was introduced by Dropbox due to an issue with Apple's policies. In older versions of the SDK an external Safari page would have been opened to do the login. Apple would not accept such Apps at some point in time. So the Dropbox guys introduced the internal view controller login, but kept the AppDelegate as the receiver of the results. If the user has the Dropbox App installed on his device, the login would be directed to the Dropbox App an also the AppDelegate will be called on return.
in App delegate add:
and in you custom class:
and