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: 

sessionDeinitialized when using authorizedClient?.withpathRoot(…)

sessionDeinitialized when using authorizedClient?.withpathRoot(…)

Swissdoode
Explorer | Level 3

Hi all

I'm trying to access a folder outside of my personal root (a team folder).

 

if let client = DropboxClientsManager.authorizedClient?.withPathRoot(.namespaceId("12345678")) {
			// do nothing
			print("dropbox connected")
			
			
//			client.users.getCurrentAccount().response(completionHandler: { user, error in
//				
//				print(user)
//				
//				let rootNamespaceId = user?.rootInfo.rootNamespaceId
//				
//				print(rootNamespaceId)
//				
			
			client.files.listFolder(path: "").response(completionHandler:  { response, error in
				
				if let result = response {
					print(Thread.current)
					print(Thread.main)
					print(result)
				} else if let err = error {
					
					print(err)
					
				}
				
			})
		}

 

I'm getting a «sessionDeinitialized» when I try to get the folder contents.

Without the «withPathRoot» everything works fine.

I get the namespaceId from the user info (the part that's commented out).

 

What am I doing wrong?

 What am I doing wrong?

1 Reply 1

Greg-DB
Dropbox Staff

Note that the requests are performed asynchronously, and from the sessionDeinitialized error it sounds like your client object was released (and accordingly the underlying session was deinitialized) before the request could be completed; to fix that you'd need to update your code to keep that client object around while the request(s) complete. 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?