What is the Dropbox iOS app's equivalent of “f

2019-04-01 00:59发布

问题:

Sorry, I can tell I don't entirely know what I'm talking about. For example, to open a URL for Facebook, the prefix is "fb://". Does anyone happen to know the prefix for Dropbox?

I'm pretty sure it has one, because in the new Dropbox API (1.0) it opens the Dropbox app from within your app to let the user log in, and the only way I know of doing this would be through one of those prefix things which I don't know what they are called.

I do not actually want to open a file in Dropbox. I actually want to detect whether Dropbox is installed on the iPhone, and the best way that I can think of to do this is with this method (shown for detecting whether the Facebook app is installed).

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]]) {
    NSLog(@"Facebook is installed.");
} else {
    NSLog(@"Facebook is not installed.");
}

If you know a better way of detecting whether this app is installed please share.

回答1:

The only URL scheme listed in Dropbox's Info.plist is dbapi-1; that should work for what you're trying to do.

Edit: Just tried it out; it works (says "installed" on my device with Dropbox and "not installed" in the simulator).