how to know the objectId of an object that has just been saved ?

hi,
i’m trying to delete an object that i created using the save API.
the issue here is that i don’t have the objectId or any other uniq value to use for deletion.
how can i get the new objects Id or how should i best delete that object without too many network calls?

Hi Tommy,

An object cannot be deleted if it does not have objectId. You can declare the objectId property in the class representing the object. Once you have an object you can check the value of the objectId property which is assigned by Backendless after the object had been persisted.

Mark



This line of code:

[commentLikerDataStore save:userCommentLiker];

Returns an object which is the one saved on the server. Your original object (userCommentLiker) is not modified, so objectId in there will stay null.

hi mark, 
after the following lines : 
id<IDataStore> commentLikerDataStore = [backendless.persistenceService of:[CommentLiker class]];
CommentLiker* userCommentLiker = [[CommentLiker alloc]init];
[commentLikerDataStore save:userCommentLiker];

i’m trying to print the objectId and it’s always null (added an objectId property to the class),

what might be the problem ?
thank you