cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: 

SwiftyDropBox SwiftyDropbox.MobileSafariViewController not in the window hierarchy

SwiftyDropBox SwiftyDropbox.MobileSafariViewController not in the window hierarchy

NeilHowarth
Helpful | Level 6
Go to solution

Hi, I have developed an application in Xcode (macOS) for iOS and I have integrated the SwiftyDropBox API. I have followed all the instructions in the README, but when I make a call to open a link to DropBox I get the following error.

Warning: Attempt to present <SwiftyDropbox.MobileSafariViewController: 0x7fb17981d800> on <Scipple_V2_0.ViewController: 0x7fb177c29d00> whose view is not in the window hierarchy!

I have Googled this to death but can't find an answer.

The initial DropboxClientsManager.setupWithAppKey seems to work (I am using the App Key I get from the App Console in DropBox.

Can anyone give me any suggestions how to fix this?

Thanks

Neil

 

 

 

 

1 Accepted Solution

Accepted Solutions

NeilHowarth
Helpful | Level 6
Go to solution

Hi,

I think you're right but not sure what I was doing wrong, the call is in my viewcontroller, however I tried

DropboxClientsManager.authorizeFromController(UIApplication.shared, controller: UIApplication.shared.keyWindow!.rootViewController!, openURL: { (url: URL) -> Void in UIApplication.shared.open(url, options: [:], completionHandler: nil) })

i.e. using rootViewController instead of self and it worked.

Thanks for your response

Neil


@Greg-DB wrote:

When/where are you calling authorizeFromController?

This error message generally indicates that the authorization window can't be displayed because it relies on yourViewController, but theViewController wasn't in the window hierarchy (yet?) at time of the call. Perhaps your ViewController wasn't presented (or was already dimissed) at the time? 


 

View solution in original post

2 Replies 2

Greg-DB
Dropbox Staff
Go to solution

When/where are you calling authorizeFromController?

This error message generally indicates that the authorization window can't be displayed because it relies on yourViewController, but theViewController wasn't in the window hierarchy (yet?) at time of the call. Perhaps your ViewController wasn't presented (or was already dimissed) at the time? 

NeilHowarth
Helpful | Level 6
Go to solution

Hi,

I think you're right but not sure what I was doing wrong, the call is in my viewcontroller, however I tried

DropboxClientsManager.authorizeFromController(UIApplication.shared, controller: UIApplication.shared.keyWindow!.rootViewController!, openURL: { (url: URL) -> Void in UIApplication.shared.open(url, options: [:], completionHandler: nil) })

i.e. using rootViewController instead of self and it worked.

Thanks for your response

Neil


@Greg-DB wrote:

When/where are you calling authorizeFromController?

This error message generally indicates that the authorization window can't be displayed because it relies on yourViewController, but theViewController wasn't in the window hierarchy (yet?) at time of the call. Perhaps your ViewController wasn't presented (or was already dimissed) at the time? 


 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    NeilHowarth Helpful | Level 6
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?