Search code examples
iossdkquickblox

Quickblox: Is it possible to delete all custom objects created by the user


Is it possible to delete all custom objects of specific class for the current user with one API call?

The call could be something like this:

[QBCustomObjects deleteObjectsForClassName:@"ClassName" delegate:self];

This would be useful when the user wants to delete his/her account or otherwise would like to remove all entries he has created for the specific class.

In addition, this would be beneficial in case the application has, for any reason, lost the class IDs needed in deleting individual objects. This would then remove the additional step to get all class ids first before starting to remove them individually.

Please let me know if this is possible and I have missed something.. And any tips on how to do this in most efficient way in terms of bandwidth & API usage are appreciated.

Thanks in advance!

(I am using Quickblox iOS SDK: version with latest git commit: Wed Nov 27 18:52:20 2013)


Solution

  • You can delete all objects for specific class in 3 steps:

    1) Retrieve all objects by QBCustomObjects class:

    objectsWithClassName:extendedRequest:delegate:
    

    2) Create array, going through all items in a loop and collect their item ID.

    3) Perform deleting by QBCustomObjects class (and pass array of IDs)

    deleteObjectsWithIDs:className:delegate:
    

    (For more details how to use this methods, please check this http://sdk.quickblox.com/ios/Classes/QBCustomObjects.html)

    PS: I don't know, may be this feature appear in SDK later.