简体   繁体   中英

Dropbox login View sample code

I am following the Dropbox tutorial and it gives me this code:

- (IBAction)pressLink {
[[DBAccountManager sharedManager] linkFromController:YOUR_ROOT_CONTROLLER];
}

This is supposed to be linked to a button and it should show the login screen for dropbox, i changed the YOUR_ROOT_CONTROLLER section of code to settings , which is the view that holds the button that is being pressed. But when i press the button, nothing happens. It says ROOT , so is it asking for my actual initial view controller?

Here is my code:

- (IBAction)pressLink
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
SettingsViewController * settings = (SettingsViewController *) [storyboard instantiateViewControllerWithIdentifier:@"settings"];
[[DBAccountManager sharedManager] linkFromController:settings];
}

This is what i changed the button method to, because with just YOUR_ROOT_CONTROLLER there, it was giving me an error, but now, as i said it does nothing. Any help would be greatly appreciated! THanks

If you're saying that settings is the controller where you have the above code, then you shouldn't be instantiating a new instance of SettingsViewController. You should just pass self to linkFromController:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM