diff --git a/README.md b/README.md
index 1f8feb0d0..91b4a89bb 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ Full documentation [here](http://dropbox.github.io/dropbox-sdk-obj-c/api-docs/la
* [Xcode 8 and iOS 10 bug](#xcode-8-and-ios-10-bug)
* [Get started](#get-started)
* [Register your application](#register-your-application)
- * [Obtain an OAuth2 token](#obtain-an-oauth2-token)
+ * [Obtain an OAuth 2.0 token](#obtain-an-oauth-20-token)
* [SDK distribution](#sdk-distribution)
* [CocoaPods](#cocoapods)
* [Carthage](#carthage)
@@ -70,9 +70,9 @@ Full documentation [here](http://dropbox.github.io/dropbox-sdk-obj-c/api-docs/la
Before using this SDK, you should register your application in the [Dropbox App Console](https://dropbox.com/developers/apps). This creates a record of your app with Dropbox that will be associated with the API calls you make.
-### Obtain an OAuth2 token
+### Obtain an OAuth 2.0 token
-All requests need to be made with an OAuth2 access token. An OAuth token represents an authenticated link between a Dropbox app and
+All requests need to be made with an OAuth 2.0 access token. An OAuth token represents an authenticated link between a Dropbox app and
a Dropbox user account or team.
Once you've created an app, you can go to the App Console and manually generate an access token to authorize your app to access your own Dropbox account.
@@ -204,9 +204,9 @@ add the following code to your application's `.plist` file:
dbapi-2
```
-This allows the Objective-C SDK to determine if the official Dropbox iOS app is installed on the current device. If it is installed, then the official Dropbox iOS app can be used to programmatically obtain an OAuth2 access token.
+This allows the Objective-C SDK to determine if the official Dropbox iOS app is installed on the current device. If it is installed, then the official Dropbox iOS app can be used to programmatically obtain an OAuth 2.0 access token.
-Additionally, your application needs to register to handle a unique Dropbox URL scheme for redirect following completion of the OAuth2 authorization flow. This URL scheme should have the format `db-`, where `` is your
+Additionally, your application needs to register to handle a unique Dropbox URL scheme for redirect following completion of the OAuth 2.0 authorization flow. This URL scheme should have the format `db-`, where `` is your
Dropbox app's app key, which can be found in the [App Console](https://dropbox.com/developers/apps).
You should add the following code to your `.plist` file (but be sure to replace `` with your app's app key):
@@ -235,7 +235,7 @@ After you've made the above changes, your application's `.plist` file should loo
### Handling the authorization flow
-There are three methods to programmatically retrieve an OAuth2 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
* **In-app webview auth** (iOS, macOS): This opens a pre-built in-app webview for authenticating via the Dropbox authorization page. This is convenient because the user is never redirected outside of your app.
@@ -382,7 +382,7 @@ Now you're ready to begin making API requests!
## Try some API requests
-Once you have obtained an OAuth2 token, you can try some API v2 calls using the Objective-C SDK.
+Once you have obtained an OAuth 2.0 token, you can try some API v2 calls using the Objective-C SDK.
### Dropbox client instance
@@ -424,13 +424,14 @@ Note: Response handlers are required for all endpoints. Progress handlers, on th
#### RPC-style request
```objective-c
-[[client.filesRoutes createFolder:@"/test/path"] response:^(DBFILESFolderMetadata *result, DBFILESCreateFolderError *routeError, DBError *error) {
- if (result) {
- NSLog(@"%@\n", result);
- } else {
- NSLog(@"%@\n%@\n", routeError, error);
- }
-}];
+[[client.filesRoutes createFolder:@"/test/path"]
+ response:^(DBFILESFolderMetadata *result, DBFILESCreateFolderError *routeError, DBError *error) {
+ if (result) {
+ NSLog(@"%@\n", result);
+ } else {
+ NSLog(@"%@\n%@\n", routeError, error);
+ }
+ }];
```
---
@@ -512,27 +513,28 @@ If at run time you attempt to access a union instance field that is not associat
#### Route-specific errors
```objective-c
-[[client.filesRoutes delete_:@"/test/path"] response:^(DBFILESMetadata *result, DBFILESDeleteError *routeError, DBError *error) {
- if (result) {
- NSLog(@"%@\n", result);
- } else {
- // Error is with the route specifically (status code 409)
- if (routeError) {
- if ([routeError isPathLookup]) {
- // Can safely access this field
- DBFILESLookupError *pathLookup = routeError.pathLookup;
- NSLog(@"%@\n", pathLookup);
- } else if ([routeError isPathWrite]) {
- DBFILESWriteError *pathWrite = routeError.pathWrite;
- NSLog(@"%@\n", pathWrite);
-
- // This would cause a runtime error
- // DBFILESLookupError *pathLookup = routeError.pathLookup;
+[[client.filesRoutes delete_:@"/test/path"]
+ response:^(DBFILESMetadata *result, DBFILESDeleteError *routeError, DBError *error) {
+ if (result) {
+ NSLog(@"%@\n", result);
+ } else {
+ // Error is with the route specifically (status code 409)
+ if (routeError) {
+ if ([routeError isPathLookup]) {
+ // Can safely access this field
+ DBFILESLookupError *pathLookup = routeError.pathLookup;
+ NSLog(@"%@\n", pathLookup);
+ } else if ([routeError isPathWrite]) {
+ DBFILESWriteError *pathWrite = routeError.pathWrite;
+ NSLog(@"%@\n", pathWrite);
+
+ // This would cause a runtime error
+ // DBFILESLookupError *pathLookup = routeError.pathLookup;
+ }
}
+ NSLog(@"%@\n%@\n", routeError, error);
}
- NSLog(@"%@\n%@\n", routeError, error);
- }
-}];
+ }];
```
---
@@ -545,37 +547,38 @@ The `DBError` type is a special union type which is similar to the standard API
As with accessing associated values in regular unions, the `as` should only be called after the corresponding `is` method returns true. See below:
```objective-c
-[[client.filesRoutes delete_:@"/test/path"] response:^(DBFILESMetadata *result, DBFILESDeleteError *routeError, DBError *error) {
- if (result) {
- NSLog(@"%@\n", result);
- } else {
- if (routeError) {
- // see handling above
- }
- // Error not specific to the route (status codes 500, 400, 401, 403, 404, 429)
- else {
- if ([error isInternalServerError]) {
- DBRequestInternalServerError *internalServerError = [error asInternalServerError];
- NSLog(@"%@\n", internalServerError);
- } else if ([error isBadInputError]) {
- DBRequestBadInputError *badInputError = [error asBadInputError];
- NSLog(@"%@\n", badInputError);
- } else if ([error isAuthError]) {
- DBRequestAuthError *authError = [error asAuthError];
- NSLog(@"%@\n", authError);
- } else if ([error isRateLimitError]) {
- DBRequestRateLimitError *rateLimitError = [error asRateLimitError];
- NSLog(@"%@\n", rateLimitError);
- } else if ([error isHttpError]) {
- DBRequestHttpError *genericHttpError = [error asHttpError];
- NSLog(@"%@\n", genericHttpError);
- } else if ([error isClientError]) {
- DBRequestClientError *genericLocalError = [error asClientError];
- NSLog(@"%@\n", genericLocalError);
+[[client.filesRoutes delete_:@"/test/path"]
+ response:^(DBFILESMetadata *result, DBFILESDeleteError *routeError, DBError *error) {
+ if (result) {
+ NSLog(@"%@\n", result);
+ } else {
+ if (routeError) {
+ // see handling above
+ }
+ // Error not specific to the route (status codes 500, 400, 401, 403, 404, 429)
+ else {
+ if ([error isInternalServerError]) {
+ DBRequestInternalServerError *internalServerError = [error asInternalServerError];
+ NSLog(@"%@\n", internalServerError);
+ } else if ([error isBadInputError]) {
+ DBRequestBadInputError *badInputError = [error asBadInputError];
+ NSLog(@"%@\n", badInputError);
+ } else if ([error isAuthError]) {
+ DBRequestAuthError *authError = [error asAuthError];
+ NSLog(@"%@\n", authError);
+ } else if ([error isRateLimitError]) {
+ DBRequestRateLimitError *rateLimitError = [error asRateLimitError];
+ NSLog(@"%@\n", rateLimitError);
+ } else if ([error isHttpError]) {
+ DBRequestHttpError *genericHttpError = [error asHttpError];
+ NSLog(@"%@\n", genericHttpError);
+ } else if ([error isClientError]) {
+ DBRequestClientError *genericLocalError = [error asClientError];
+ NSLog(@"%@\n", genericLocalError);
+ }
}
}
- }
-}];
+ }];
```
---
@@ -591,26 +594,27 @@ For example, the [/delete](https://www.dropbox.com/developers/documentation/http
To determine at runtime which subtype the `Metadata` type exists as, perform an `isKindOfClass` check for each possible class, and then cast the result accordingly. See below:
```objective-c
-[[client.filesRoutes delete_:@"/test/path"] response:^(DBFILESMetadata *result, DBFILESDeleteError *routeError, DBError *error) {
- if (result) {
- if ([result isKindOfClass:[DBFILESFileMetadata class]]) {
- DBFILESFileMetadata *fileMetadata = (DBFILESFileMetadata *)result;
- NSLog(@"%@\n", fileMetadata);
- } else if ([result isKindOfClass:[DBFILESFolderMetadata class]]) {
- DBFILESFolderMetadata *folderMetadata = (DBFILESFolderMetadata *)result;
- NSLog(@"%@\n", folderMetadata);
- } else if ([result isKindOfClass:[DBFILESDeletedMetadata class]]) {
- DBFILESDeletedMetadata *deletedMetadata = (DBFILESDeletedMetadata *)result;
- NSLog(@"%@\n", deletedMetadata);
- }
- } else {
- if (routeError) {
- // see handling above
+[[client.filesRoutes delete_:@"/test/path"]
+ response:^(DBFILESMetadata *result, DBFILESDeleteError *routeError, DBError *error) {
+ if (result) {
+ if ([result isKindOfClass:[DBFILESFileMetadata class]]) {
+ DBFILESFileMetadata *fileMetadata = (DBFILESFileMetadata *)result;
+ NSLog(@"%@\n", fileMetadata);
+ } else if ([result isKindOfClass:[DBFILESFolderMetadata class]]) {
+ DBFILESFolderMetadata *folderMetadata = (DBFILESFolderMetadata *)result;
+ NSLog(@"%@\n", folderMetadata);
+ } else if ([result isKindOfClass:[DBFILESDeletedMetadata class]]) {
+ DBFILESDeletedMetadata *deletedMetadata = (DBFILESDeletedMetadata *)result;
+ NSLog(@"%@\n", deletedMetadata);
+ }
} else {
- // see handling above
+ if (routeError) {
+ // see handling above
+ } else {
+ // see handling above
+ }
}
- }
-}];
+ }];
```
This `Metadata` object is known as a **datatype with subtypes** in our API v2 documentation.
@@ -661,13 +665,13 @@ By default, response/progress handler code runs on the main thread. You can set
```objective-c
[[client.filesRoutes listFolder:@""]
- response:[NSOperationQueue new] response:^(DBFILESListFolderResult *result, DBFILESListFolderError *routeError, DBError *error) {
- if (result) {
- NSLog(@"%@", [NSThread currentThread]); // Output: {number = 5, name = (null)}
- NSLog(@"%@", [NSThread mainThread]); // Output: {number = 1, name = (null)}
- NSLog(@"%@\n", result);
- }
-}];
+ response:[NSOperationQueue new] response:^(DBFILESListFolderResult *result, DBFILESListFolderError *routeError, DBError *error) {
+ if (result) {
+ NSLog(@"%@", [NSThread currentThread]); // Output: {number = 5, name = (null)}
+ NSLog(@"%@", [NSThread mainThread]); // Output: {number = 1, name = (null)}
+ NSLog(@"%@\n", result);
+ }
+ }];
```
---
diff --git a/Source/ObjectiveDropboxOfficial/ObjectiveDropboxOfficial.xcodeproj/project.pbxproj b/Source/ObjectiveDropboxOfficial/ObjectiveDropboxOfficial.xcodeproj/project.pbxproj
index cee781c20..447b48b6f 100644
--- a/Source/ObjectiveDropboxOfficial/ObjectiveDropboxOfficial.xcodeproj/project.pbxproj
+++ b/Source/ObjectiveDropboxOfficial/ObjectiveDropboxOfficial.xcodeproj/project.pbxproj
@@ -7,8 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
- F25D1B481D95B68600B748CF /* ObjectiveDropboxOfficial.h in Headers */ = {isa = PBXBuildFile; fileRef = F25D1B471D95B68600B748CF /* ObjectiveDropboxOfficial.h */; };
- F25D1B491D95B68600B748CF /* ObjectiveDropboxOfficial.h in Headers */ = {isa = PBXBuildFile; fileRef = F25D1B471D95B68600B748CF /* ObjectiveDropboxOfficial.h */; };
+ F25D1B481D95B68600B748CF /* ObjectiveDropboxOfficial.h in Headers */ = {isa = PBXBuildFile; fileRef = F25D1B471D95B68600B748CF /* ObjectiveDropboxOfficial.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ F25D1B491D95B68600B748CF /* ObjectiveDropboxOfficial.h in Headers */ = {isa = PBXBuildFile; fileRef = F25D1B471D95B68600B748CF /* ObjectiveDropboxOfficial.h */; settings = {ATTRIBUTES = (Public, ); }; };
F27DEB9A1D7FFBB9003B1CEE /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F27DEB991D7FFBB9003B1CEE /* AppKit.framework */; };
F27DEB9C1D7FFBBF003B1CEE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F27DEB9B1D7FFBBF003B1CEE /* Foundation.framework */; };
F29AFA7B1D7FF0220043800A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F29AFA7A1D7FF0220043800A /* Foundation.framework */; };
@@ -3921,7 +3921,6 @@
F2EBBCE01D921E7A004707E1 /* DBSHARINGFileMemberActionError.h in Headers */,
F2EBBD981D921E7A004707E1 /* DBSHARINGListFoldersContinueArg.h in Headers */,
F2EBC09C1D921E7C004707E1 /* DBTEAMTeamMemberStatus.h in Headers */,
- F25D1B481D95B68600B748CF /* ObjectiveDropboxOfficial.h in Headers */,
F2EBBB541D921E7A004707E1 /* DBFILESGetTemporaryLinkError.h in Headers */,
F2EBBD5C1D921E7A004707E1 /* DBSHARINGListFileMembersBatchResult.h in Headers */,
F2EBC13A1D921E7C004707E1 /* DBTasks.h in Headers */,
@@ -4150,6 +4149,7 @@
F2EBBFE81D921E7B004707E1 /* DBTEAMMembersDeactivateArg.h in Headers */,
F2EBBD681D921E7A004707E1 /* DBSHARINGListFileMembersCountResult.h in Headers */,
F2EBBDEC1D921E7A004707E1 /* DBSHARINGRelinquishFileMembershipError.h in Headers */,
+ F25D1B481D95B68600B748CF /* ObjectiveDropboxOfficial.h in Headers */,
F2EBBC7C1D921E7A004707E1 /* DBPROPERTIESListPropertyTemplateIds.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -4362,7 +4362,6 @@
F2EBBCE11D921E7A004707E1 /* DBSHARINGFileMemberActionError.h in Headers */,
F2EBBD991D921E7A004707E1 /* DBSHARINGListFoldersContinueArg.h in Headers */,
F2EBC09D1D921E7C004707E1 /* DBTEAMTeamMemberStatus.h in Headers */,
- F25D1B491D95B68600B748CF /* ObjectiveDropboxOfficial.h in Headers */,
F2EBBB551D921E7A004707E1 /* DBFILESGetTemporaryLinkError.h in Headers */,
F2EBBD5D1D921E7A004707E1 /* DBSHARINGListFileMembersBatchResult.h in Headers */,
F2EBC13B1D921E7C004707E1 /* DBTasks.h in Headers */,
@@ -4591,6 +4590,7 @@
F2EBBFE91D921E7B004707E1 /* DBTEAMMembersDeactivateArg.h in Headers */,
F2EBBD691D921E7A004707E1 /* DBSHARINGListFileMembersCountResult.h in Headers */,
F2EBBDED1D921E7A004707E1 /* DBSHARINGRelinquishFileMembershipError.h in Headers */,
+ F25D1B491D95B68600B748CF /* ObjectiveDropboxOfficial.h in Headers */,
F2EBBC7D1D921E7A004707E1 /* DBPROPERTIESListPropertyTemplateIds.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
diff --git a/Source/ObjectiveDropboxOfficial/PlatformNeutral/ObjectiveDropboxOfficial.h b/Source/ObjectiveDropboxOfficial/PlatformNeutral/ObjectiveDropboxOfficial.h
index 0617ea0e3..5baebb420 100644
--- a/Source/ObjectiveDropboxOfficial/PlatformNeutral/ObjectiveDropboxOfficial.h
+++ b/Source/ObjectiveDropboxOfficial/PlatformNeutral/ObjectiveDropboxOfficial.h
@@ -8,9 +8,9 @@
#import "TargetConditionals.h"
#if TARGET_OS_IPHONE
- #import
+#import
#else
- #import
+#import
#endif
//! Project version number for ObjectiveDropboxOfficial.
@@ -23,7 +23,7 @@ FOUNDATION_EXPORT const unsigned char ObjectiveDropboxOfficialVersionString[];
//
#if TARGET_OS_IPHONE
- #import
+#import
#else
- #import
+#import
#endif