I think we've just found an error in removeObjectAtIndex method in Objective-C API
Below is the code we used to find and remove an object from the array, for some reason it KEEPS deleting the LAST element of the array regardless of what index you passed in.
- Code: Select all
MyObject *myobject=[MyObject sharedMyObject];
PIODatabaseArray *array=[myobject.myAllPIODatabaseObject arrayForProperty:@"BuildingObjects"];
for (int i=0; i<array.count; i++) {
if ([sprite.SpritePIODatabaseObject isEqual:[array objectAtIndex:i]]) {
[array removeObjectAtIndex:i];
break;
}
}
[myobject.myAllObjectInfo saveWithSuccessBlock:^{
} errorBlock:^(PIOError *error) {
}];
Also, is it possible to have a built-in method that removes a particular object by passing it as a parameter, something like this ---
- Code: Select all
- (PIODatabaseArray*) removeObject:(PIODatabaseObject*)Obj;
Or do we have to write it ourselves, if so, any good idea on how to implement it efficiently?