We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
billymeltdown
10 years agoExplorer | Level 4
Getting rev from DBFILESMetadata in obj-c API 2
Dear Dropbox, Thanks for the new obj-c API v2, looks like quite an effort! So far it's more convenient to use than API v1 and integration is going well. However, I'm a little held up on how to wo...
- 10 years ago
In your example, you would get it like this:
self.dropboxFileRevision = ([result isKindOfClass:[DBFILESFileMetadata class]] ? [(DBFILESFileMetadata *)result rev] : nil);
DBFILESFileMetadata is a subclass of DBFILESMetadata. Basically (as I understand it), you’ll never receive a vanilla DBFILESMetadata object in a response, but will receive one of its subclasses - DBFILESFolderMetadata, DBFILESFileMetadata or DBFILESDeletedMetadata. So you need to check the class of the meta-data object to see what you can extract from it. (I wrote a category so that I can call -isDirectory, -isFile or -isDeleted on the meta-data object rather than have to write out -isKindOfClass: each time.)
(I’ve been getting to grips with the new API msyelf over the past few days, and the above comes from hounding Greg at Dropbox with questions. :) )
Keith B.7
10 years agoHelpful | Level 7
In your example, you would get it like this:
self.dropboxFileRevision = ([result isKindOfClass:[DBFILESFileMetadata class]] ? [(DBFILESFileMetadata *)result rev] : nil);
DBFILESFileMetadata is a subclass of DBFILESMetadata. Basically (as I understand it), you’ll never receive a vanilla DBFILESMetadata object in a response, but will receive one of its subclasses - DBFILESFolderMetadata, DBFILESFileMetadata or DBFILESDeletedMetadata. So you need to check the class of the meta-data object to see what you can extract from it. (I wrote a category so that I can call -isDirectory, -isFile or -isDeleted on the meta-data object rather than have to write out -isKindOfClass: each time.)
(I’ve been getting to grips with the new API msyelf over the past few days, and the above comes from hounding Greg at Dropbox with questions. :) )
- billymeltdown10 years agoExplorer | Level 4
Ah, ha! Awesome, thanks Keith!
About 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!