Skip to content

Commit

Permalink
Updated README to include instructions to force app to foreground.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Cobbe committed May 17, 2017
1 parent b906b16 commit 72d30fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,11 @@ After you've made the above changes, your application's `.plist` file should loo

### Handling the authorization flow

There are two methods to programmatically retrieve an OAuth 2.0 access token:
There are three methods to programmatically retrieve an OAuth 2.0 access token:

* **Direct auth** (iOS only): This launches the official Dropbox iOS app (if installed), authenticates via the official app, then redirects back into the SDK
* **Safari view controller auth** (iOS, macOS): This launches a `SFSafariViewController` to facillitate the auth flow. This is desirable because it is safer for the end-user, and pre-existing session data can be used to avoid requiring the user to re-enter their Dropbox credentials.
* **Safari view controller auth** (iOS only): This launches a `SFSafariViewController` to facillitate the auth flow. This is desirable because it is safer for the end-user, and pre-existing session data can be used to avoid requiring the user to re-enter their Dropbox credentials.
* **Redirect to external browser** (macOS only): This launches the user's default browser to facillitate the auth flow. This is also desirable because it is safer for the end-user, and pre-existing session data can be used to avoid requiring the user to re-enter their Dropbox credentials.

To facilitate the above authorization flows, you should take the following steps:

Expand Down Expand Up @@ -403,6 +404,9 @@ To handle the redirection back into the Objective-C SDK once the authentication
} else if ([authResult isError]) {
NSLog(@"Error: %@", authResult);
}
// this forces your app to the foreground, after it has handled the browser redirect
[[NSRunningApplication currentApplication]
activateWithOptions:(NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps)];
}
}
```
Expand Down
2 changes: 2 additions & 0 deletions TestObjectiveDropbox/TestObjectiveDropbox_macOS/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ - (void)handleAppleEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSApple
}
}
[self checkButtons];
[[NSRunningApplication currentApplication]
activateWithOptions:(NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps)];
}

- (void)checkButtons {
Expand Down

0 comments on commit 72d30fb

Please sign in to comment.