We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

Swissdoode's avatar
Swissdoode
Explorer | Level 3
2 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?

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox 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.