Support Topics Documentation Slack YouTube Blog

Breaking change: GeoPoint metadata not updated correctly

Backendless Version (3.x / 5.x, Online / Managed / Pro )

Online

Client SDK (REST / Android / Objective-C / Swift / JS )

Android & ObjectiveC (tested verstions 5 & 6)

Application ID

BDCD56B9-351A-E067-FFA4-9EA9CF2F4000

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

  1. Create a GeoPoint with metadata that contains a string (e.g. { “status” : “0” } )
  2. Update the GeoPoint setting another value for that key in the metadata (e.g. {“status” : “1” } )
    Expected result:
    GeoPoint metadata has value {“status” : “1” }

Actual Behavior

Actual result:
GeoPoint metadata has value {“status” : [“0”, “1”] }
(New value is added to an array along with the old one instead of replacing it)
Setting another distinct value to the metadata (e.g. {“status” : “2” } ) has the effect of adding it to the array: {“status” : [“0”, “1”, “2”] }
Setting another value to the metadata that is already contained in the array (e.g. {“status” : “2” } again) has no effect: {“status” : [“0”, “1”, “2”] }

This is something that behaved as expected before and has changed soon (probably with the update to v6)!

Reproducible Test Case

I observed the above mentioned behaviour in both my iOS and Android apps. So this is probably a problem in the backend, not the SDKs. Even though I have tested it with both v5 and v6 of the SDKs and the behaviour remains the same.
Code for iOS (https://github.com/HelpAPaw/FriendsInNeed/blob/3800fd9643b02bdcec0d4f8aec45ea1ab32b943d/FriendsInNeed/FINDataManager.m#L397):

    GeoPoint *point = [signal geoPoint];
    [point.metadata setObject:[NSString stringWithFormat:@"%lu", (unsigned long)status] forKey:kSignalStatusKey];
    // Here point.metadata is correct
    [backendless.geoService savePoint:point response:^(GeoPoint *returnedGeoPoint) {
        //returnedGeoPoint has correct metadata, too
        signal.geoPoint = returnedGeoPoint;
        ...
    
    } error:^(Fault *fault) {
        ...
    }];

As mentioned in the comments - saving looks fine. However, when the same GeoPoint is obtained it has different metadata.

Code for Android (https://github.com/HelpAPaw/Android/blob/fd20fddbc5c5a65dbb9b25974e86092bf7ecb276/app/src/main/java/org/helpapaw/helpapaw/data/repositories/BackendlessSignalRepository.java#L225):

                    Map<String, Object> meta = signalPoint.getMetadata();
                    meta.put(SIGNAL_STATUS, status);
                    //meta has correct value here

                    signalPoint.setMetadata(meta);
                    Backendless.Geo.savePoint(signalPoint, new AsyncCallback<GeoPoint>() {
                        @Override
                        public void handleResponse(GeoPoint geoPoint) {
                            String newSignalStatusString = getToStringOrNull(geoPoint.getMetadata(SIGNAL_STATUS));
                            //metadata has correct value here
                            ...
                        }

                        @Override
                        public void handleFault(BackendlessFault fault) {
                            ...
                        }
                    });

My app is open-source so the bug can be reproduced with the following steps (doesn’t matter iOS or Android):

  1. Start app and tap 7 times on the app title “Help a Paw” to switch to test mode (title changes to “Help a Paw (TEST)”)
  2. Open side menu and tap Login
  3. Login or register
  4. Go back to main screen
  5. Tap the plus button in top or bottom right corner
  6. Write some text and tap submit
  7. Tap the popup of the newly created signal to open it
  8. Tap status and select another one

This bug makes my app unusable so I hope it will be resolved ASAP!

Hi @milen-marinov!

Sorry for inconvenience. Internal ticket BKNDLSS-22001 was created for this problem. We will deliver fix as soon as possible.

Regards, Andriy

1 Like

Hello @milen-marinov

We’ve just updated cloud servers with a fix for the issue you described above. Could you kindly let us know whether fix works for you well?

Regards,
Inna

1 Like

Hello,

I confirm that the bug is fixed!

Best,
Milen