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: 

Re: Redirect after login not completing and app is closing. (SwiftyDropBox)

Redirect after login not completing and app is closing. (SwiftyDropBox)

Jordan B.7
New member | Level 1

I've followed the SwiftyDropbox tutorial and after linking the app to my (user) db account the app just quits with out throwing any errors after the redirect back to the app.

This is my console output. 

These "errors" occur after the button press.

I don't get a console print saying 

"Success! User is logged into Dropbox with token: \(token)"

This is my VC.swift

This is the relevant code in my AppDelegate.swfit 

Console output


 

7 Replies 7

Greg-DB
Dropbox Staff

What version of iOS are you running? The only thing that looks potentially wrong is that you're using the older version of the openURL method.

There's a note in the tutorial here about that:

https://www.dropbox.com/developers/documentation/swift#tutorial

You can use this version for 9.0+:

func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {

The version you're using is for <9.0:

func application(app: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {

Jordan B.7
New member | Level 1

Thanks for the response.

I am on iOS 9,

I made the code change to the appropriate openURL method and It still fails to redirect. 

When I get to the DB login screen and hit "Cancel" It also fails to redirect.

This is my info.plist

 and code for relevant section:

<key>LSApplicationQueriesSchemes</key>
<array>
<string>dbapi-2</string>
<string>dbapi-8-emm</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>db-u3tf1l9k3flsira</string>
</array>
</dict>
</array>

 

Greg-DB
Dropbox Staff

Thanks for the additional information. In your original post though, you said "the app just quits with out throwing any errors after the redirect back to the app", however in your last reply you said it "still fails to redirect". Can you clarify what redirect does or doesn't occur, and when the app quits exactly?

In any case, if you can provide a sample project, that would be most helpful so we can reproduce it and look into it. Thanks in advance! 

Jordan B.7
New member | Level 1

It segues back to a white screen and then the app quits

Jordan B.7
New member | Level 1

Greg-DB
Dropbox Staff

Thanks Jordan! That actually works fine for me though. I get redirected back to the test app and get the "Success! User is logged into Dropbox with token: ..." message on a device running iOS 9 with the official Dropbox app installed.

Is this happening on multiple devices/simulators for you?

You may also want to try deleting the Pods and reinstalling with pod install just in case something was broken in your pod installation.

ykchau
New member | Level 2

I've got the similar problem (I can't see your image, it's link was broken), but I found that the reason I've got this problem is because I was changing the name of my app, however the old copy of the app is still installed on the device, therefore, while dropbox api redirect, it go to the old app rather than the new app, so I remove the old app and everything work perfectly!

Need more support?