Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

Swissdoode's avatar
Swissdoode
Explorer | Level 3
3 years ago

sessionDeinitialized when using authorizedClient?.withpathRoot(…)

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

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    3 years ago

    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. 

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!