I have a table with a column named “location” of type POINT WGS 84
. I want to update the value of a single column in a single row in that table. This is my code:
MapDrivenDataStore *dataStore = [Backendless.shared.data ofTable:[self getSignalsTableName]];
[dataStore findByIdWithObjectId:signal.signalId responseHandler:^(NSDictionary<NSString *,id> * _Nonnull signalMap) {
NSMutableDictionary *updatedSignalMap = [NSMutableDictionary dictionaryWithDictionary:signalMap];
[updatedSignalMap setObject:[NSNumber numberWithUnsignedInteger:status] forKey:kField_Status];
[dataStore updateWithEntity:updatedSignalMap
responseHandler:^(NSDictionary<NSString *,id> * _Nonnull updatedSignal) {
[self sendPushNotificationsForNewStatus:status onSignal:signal withCurrentComments:currentComments];
signal.status = status;
completion(nil);
} errorHandler:^(Fault * _Nonnull fault) {
FINError *error = [[FINError alloc] initWithMessage:fault.message];
completion(error);
}];
} errorHandler:^(Fault * _Nonnull fault) {
FINError *error = [[FINError alloc] initWithMessage:fault.message];
completion(error);
}];
However, upon execution I get the following error:
Error Domain=BackendlessErrorDomain Code=0 “Can not create BackendlessGeometry from type weborb.reader.CacheableAdaptingTypeWrapper” UserInfo={NSLocalizedDescription=Can not create BackendlessGeometry from type weborb.reader.CacheableAdaptingTypeWrapper}
If I try to convert the “location” value (which is of type BLPoint) to GeoJSON like this:
BLPoint *blPoint = [updatedSignalMap objectForKey:kField_Location];
NSDictionary *jsonPoint = [blPoint asGeoJson];
[updatedSignalMap setObject:jsonPoint forKey:kField_Location];
I get the same error:
Error Domain=BackendlessErrorDomain Code=0 “Can not create BackendlessGeometry from type weborb.reader.CacheableAdaptingTypeWrapper” UserInfo={NSLocalizedDescription=Can not create BackendlessGeometry from type weborb.reader.CacheableAdaptingTypeWrapper}
Converting to WKT point:
BLPoint *blPoint = [updatedSignalMap objectForKey:kField_Location];
NSString *wktPoint = [blPoint asWkt];
[updatedSignalMap setObject:wktPoint forKey:kField_Location];
returns:
Error Domain=BackendlessErrorDomain Code=0 “Can not create BackendlessGeometry from type weborb.reader.StringType” UserInfo={NSLocalizedDescription=Can not create BackendlessGeometry from type weborb.reader.StringType}
So, how am I supposed to update a table with a spatial data column in it!?
Also, is it possible to update only a single column without sending the rest of the columns in the dictionary? Currently this results in deleting their values.