cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DropboxClientsManager authorizeFromController not doing anything

DropboxClientsManager authorizeFromController not doing anything

Bob S.15
Collaborator | Level 9
Go to solution

Hello,

 

   I'm having trouble presenting the Dropbox login to the user.  I had it working some time ago, but today I tried it and nothing happens.  I make this call and nothing happens.  

 

 

 [DropboxClientsManager authorizeFromController:[UIApplication sharedApplication]
                                        controller:VC
                                           openURL:^(NSURL *url) {
                                               [[UIApplication sharedApplication] openURL:url];
                                           }
                                       browserAuth:NO];

 

I've tried it with browserAuth set to YES too, and get the same problem.  Has anything changed recently?  

I don't see any errors or any text at all on the console.  Any idea what could be the problem?

 

Thanks

Bob

 

1 Accepted Solution

Accepted Solutions

Bob S.15
Collaborator | Level 9
Go to solution

Hey Greg,

 

    Finally found it.  I was skipping the call to DBClientsManager setupWithAppKey!  It was in there, but I was mistakenly skipping it when my app had stored the preference that Dropbox was disconnected.  It's weird that that produces no error messages.  I found the problem by stepping in the debugger into authorizeFromController and noticing that both my sharedApplication and controller arguments were 'nil', even though they were valid values when I passed them.  Then I noticed the assert in that function:

 

 NSAssert([DBOAuthManager sharedOAuthManager] != nil,
           @"Call `Dropbox.setupWithAppKey` or `Dropbox.setupWithTeamAppKey` before calling this method");

As soon as I saw that, I knew what I had done.

 

I guess that the assert never fired, because [DBOAuthManager sharedOAuthManager] is a valid number even if you have not called setupWithAppKey?

 

Anyway thanks for helping me with this problem, I really appreciate it.  I'll probably run into more but at least this one is down.

Bob

 

View solution in original post

36 Replies 36

Greg-DB
Dropbox Staff
Go to solution
Hi Bob, since this was previously working for you, can you check your version control repository to see what may have changed here in your code? Or, did this stop working when you updated the version of the Dropbox SDK you're using?

In either case, is your "VC" parameter your view controller instance? Normally that's just provided as "self" (e.g., as shown in the documentation: https://github.com/dropbox/dropbox-sdk-obj-c#handling-the-authorization-flow ).

Bob S.15
Collaborator | Level 9
Go to solution

Well, when I say it was working, I remember it working once, but I haven't tried it in a long time.  I've been logged in so haven't really tested the login/logout stuff in a while.  The Dropbox version is the same, I haven't updated it -- until just now, I thought I would try updating it to see if that fixed the problem, but it did not.   

 

Yes, VC is the view controller, which would be 'self' if the calling object was the viewController, but in this case it is not.

 

 

 I will take another look at this tomorrow, maybe it will be clearer.  I think my other app is working OK, so I will try to see what the difference is with it.

 

Thanks, 

Bob

 

 

Greg-DB
Dropbox Staff
Go to solution

Thanks! In that case, comparing against your other app or the DBRoulette sample app would be a good place for begin troubleshooting this, since you're not getting any error or output.

 

The DBRoulette sample app does use the sample authorization flow. It's available as three versions, one for each of the supported installation methods. Give that a try when you get a chance and let us know if it does or doesn't work for you.

Bob S.15
Collaborator | Level 9
Go to solution

Hey Greg,

 

  In my other app, calling DropboxClientsManager authorizeFromController: works, but it opens the Dropbox app to ask for permission for the app to access its own folder.  It does this even though the browserAuth argument is NO.   Should it?

 

I may try to get the DBRoulette app to run.  But my dropbox-sdk-obj-c install does not look like the one you have linked.  There is no iOS folder under Examples->DBRoulette.  Instead my folder looks like this confusing mess: http://imgur.com/ZtwywU0

 

I tried updating the dropbox SDK by calling  "carthage update --platform iOS", but it did not change the structure of the Examples directory.   What do I need to do for it to update to the correct Examples folder?

 

Thanks

Bob

 

 

Greg-DB
Dropbox Staff
Go to solution

Yes, the official Dropbox app is still expected to be used in that case. The browserAuth parameter only controls what happens if the official app isn't installed. It determines whether or not to use the external browser in that case.

 

Anyway, the copy of the SDK you have checked out appears to be a bit old. You can update your Cartfile to tell Carthage to use the latest version when updating.

 

Also, to use the sample app, make sure you run the installation for the sample app itself. (Your screenshot shows that you have the SDK installed for your own app. The SDK happens to also contain the sample app, but it isn't pre-installed in the sample app.)

Bob S.15
Collaborator | Level 9
Go to solution

Okay, thanks for the reply.  A couple of questions:

 

1) If the default behavior is to open the Dropbox app, then it is more mysterious that this works in my one app but not the other.  That means it doesn't really have anything to do with viewControllers, if it's really supposed to be opening the Dropbox app.  Is there any way to make the SDK print log messages or anything to help determine why it isn't working?  

 

2) I didn't realize that I needed to manually set the update version in the cartfile.  When I changed it to  3.0.14 and call carthage update --platform iOS, now it gives me this error in the shell: 

 

A shell task (/usr/bin/xcrun xcodebuild -project /Users/me/Desktop/XXX/Carthage/Checkouts/dropbox-sdk-obj-c/Examples/DBRoulette/Carthage/DBRoulette/DBRoulette.xcodeproj CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES -list) failed with exit code 74:
xcodebuild: error: Unable to read project 'DBRoulette.xcodeproj' from folder '/Users/me/Desktop/XXX/Carthage/Checkouts/dropbox-sdk-obj-c/Examples/DBRoulette/Carthage/DBRoulette'.
	Reason: Project /Users/me/Desktop/XXX/Carthage/Checkouts/dropbox-sdk-obj-c/Examples/DBRoulette/Carthage/DBRoulette/DBRoulette.xcodeproj cannot be opened because it is missing its project.pbxproj file.

 

Also, I tried to update the Dropbox SDK for the other app, the one which works, and I got a lot more errors...?

 

The following build commands failed:
	CompileC /Users/me/Library/Developer/Xcode/DerivedData/ObjectiveDropboxOfficial-flsqvpjnrmkaevdbsxgkmpseqluy/Build/Intermediates/ObjectiveDropboxOfficial.build/Release-iphoneos/ObjectiveDropboxOfficial\ iOS.build/Objects-normal/armv7/DBTransportDefaultClient.o Shared/Handwritten/Networking/DBTransportDefaultClient.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
	CompileC /Users/me/Library/Developer/Xcode/DerivedData/ObjectiveDropboxOfficial-flsqvpjnrmkaevdbsxgkmpseqluy/Build/Intermediates/ObjectiveDropboxOfficial.build/Release-iphoneos/ObjectiveDropboxOfficial\ iOS.build/Objects-normal/armv7/DBTasks.o Shared/Handwritten/Networking/DBTasks.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBDelegate.h:80:32: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBDelegate.h:98:35: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBDelegate.h:116:37: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTransportDefaultClient.m:101:60: error: no visible @interface for 'DBUploadTaskImpl' declares the selector 'initWithTask:session:delegate:route:inputUrl:inputData:'
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTransportDefaultClient.m:123:60: error: no visible @interface for 'DBUploadTaskImpl' declares the selector 'initWithTask:session:delegate:route:inputUrl:inputData:'
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTransportDefaultClient.m:145:60: error: no visible @interface for 'DBUploadTaskImpl' declares the selector 'initWithTask:session:delegate:route:inputUrl:inputData:'
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBDelegate.h:80:32: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBDelegate.h:98:35: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBDelegate.h:116:37: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:68:34: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:76:34: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:102:4: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:102:61: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:103:61: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:105:3: error: unknown type name 'DBRpcResponseBlockStorage'; did you mean 'DBRpcResponseBlock'?
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:140:18: error: called object type 'id' is not a function or function pointer
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:141:17: error: called object type 'id' is not a function or function pointer
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:105:29: error: incompatible block pointer types initializing '__strong DBRpcResponseBlock' (aka 'void (^__strong)(TResponse  _Nullable __strong, TError  _Nullable __strong, DBRequestError * _Nullable __strong)') with an expression of type 'BOOL (^)(NSData *__strong, NSURLResponse *__strong, NSError *__strong)'
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:68:57: warning: conflicting parameter types in implementation of 'setResponseBlock:': 'DBRpcResponseBlock  _Nonnull __strong' (aka 'void (^__strong)(TResponse  _Nullable __strong, TError  _Nullable __strong, DBRequestError * _Nullable __strong)') vs '__strong id _Nonnull' [-Wmismatched-parameter-types]
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:76:57: warning: conflicting parameter types in implementation of 'setResponseBlock:queue:': 'DBRpcResponseBlock  _Nonnull __strong' (aka 'void (^__strong)(TResponse  _Nullable __strong, TError  _Nullable __strong, DBRequestError * _Nullable __strong)') vs '__strong id _Nonnull' [-Wmismatched-parameter-types]
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:155:37: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:163:37: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:189:4: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:189:64: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:190:64: error: expected a type
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:192:3: error: unknown type name 'DBUploadResponseBlockStorage'; did you mean 'DBUploadResponseBlock'?
/Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTasks.m:227:18: error: called object type 'id' is not a function or function pointer
fatal error: too many errors emitted, stopping now [-ferror-limit=]
A shell task (/usr/bin/xcrun xcodebuild -project /Users/me/Desktop/iphone/XXXX/Carthage/Checkouts/dropbox-sdk-obj-c/Source/ObjectiveDropboxOfficial/ObjectiveDropboxOfficial.xcodeproj -scheme "ObjectiveDropboxOfficial iOS" -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
** BUILD FAILED **


The following build commands failed:
	CompileC /Users/me/Library/Developer/Xcode/DerivedData/ObjectiveDropboxOfficial-flsqvpjnrmkaevdbsxgkmpseqluy/Build/Intermediates/ObjectiveDropboxOfficial.build/Release-iphoneos/ObjectiveDropboxOfficial\ iOS.build/Objects-normal/armv7/DBTransportDefaultClient.o Shared/Handwritten/Networking/DBTransportDefaultClient.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
	CompileC /Users/me/Library/Developer/Xcode/DerivedData/ObjectiveDropboxOfficial-flsqvpjnrmkaevdbsxgkmpseqluy/Build/Intermediates/ObjectiveDropboxOfficial.build/Release-iphoneos/ObjectiveDropboxOfficial\ iOS.build/Objects-normal/armv7/DBTasks.o Shared/Handwritten/Networking/DBTasks.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)

 

Any idea what that is about?  Can I just remove the whole dropbox-sdk-obj-c directory and try the update again?

 

Thanks

Bob

Greg-DB
Dropbox Staff
Go to solution

1) There isn't any way to enable additional output. It should already be yielding errors/output if something isn't working.

 

2) If you prefer, you can configure your Cartfile like this to always take the latest version:

 

# ObjectiveDropboxOfficial
github "https://github.com/dropbox/dropbox-sdk-obj-c"

The Cartfile documentation has more information on the options available.

 

You should be able to delete the folder and try again, but it may be easier to just download a separate copy of the SDK so you can test this separately.

Greg-DB
Dropbox Staff
Go to solution

There have been some breaking changes to the SDK over the various updates. (The SDKs mostly use Semantic Versioning to indicate breaking changes/feature updates/bug fixes.) If you're updating from an old version, you'll need to update your code for those changes. You can find more information in the release log.

Bob S.15
Collaborator | Level 9
Go to solution

I don't understand -- this is just from trying to update the SDK.  I have not even gotten to trying to open and compile my own project yet.  The standalone SDK did download and update correctly, however.  

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    srinivas1995 Explorer | Level 3
  • User avatar
    Bob S.15 Collaborator | Level 9
What do Dropbox user levels mean?