cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Jordan B.7 New member | Level 1
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

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

Dropboxer
Dropboxer

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 {

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

Jordan B.7 New member | Level 1
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>

 

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

Dropboxer
Dropboxer

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! 

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

Jordan B.7 New member | Level 1
New member | Level 1

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

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

Jordan B.7 New member | Level 1
New member | Level 1

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

Dropboxer
Dropboxer

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.

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

ykchau New member | Level 2
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!

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?