FAULT = '1001' [Cannot update object without any properties: metadata] iOS

  let match = Matches()
        match.byUser = currentLoggedInUser
        match.toUser = forUser
        match.liked = true
        
        let dataStore = backendless.data.of(Matches.ofClass())
        
        
        // save object asynchronously
        dataStore.save(
            match,
            response: { (result: AnyObject!) -> Void in
            if let obj = result as? Matches {
                //print("Contact has been saved: \(obj.objectId)")
       
            }
            },
            error: { (fault: Fault!) -> Void in
                print("fServer reported an error: \(fault)")
            })
My App id is 5F3BA2F5-9BAA-E70F-FF7E-CDA02D820600

The log prints.
fServer reported an error: FAULT = ‘1001’ [Cannot update object without any properties: metadata] <Cannot update object without any properties: metadata>

The error logs are also very poor in your sdk. It should really give a pointer to what is failing. I see sometime Nullpointer exception etc.
My guess is it is failing at GeoPoint location since that is only with the metadata in the log but since there is no good doc on error, i might be wasting my time and thought to ask here.

When i log currentLoggedInUser . output is like this (note replaced location and url with some random letter)
toUser log is kinda similar

&lt;BackendlessUser&gt; {
    Discovery = 1;
    "__meta" = "{\"relationRemovalIds\":{},\"selectedProperties\":[\"gender\",\"___savedRelations\",\"about\",\"admin\",\"dpSmall\",\"ownerId\",\"password\",\"___class\",\"launchFirst\",\"objectId\",\"email\",\"locationLimit\",\"fname\",\"dpLarge\",\"created\",\"Discovery\",\"__meta\",\"lastnameTF\",\"nationality\",\"maxAge\",\"__relatedschemageopoint\",\"minAge\",\"name\",\"location\",\"interested\",\"updated\",\"age\"],\"relatedObjects\":{\"location\":[\"98384BEF-085D-3FEB-FF49-D3CDA02B1200\"]}}";
    about = "I just Joined Modo";
    admin = 0;
    age = 18;
    created = "2016-05-11 07:54:54 +0000";
    dpLarge = "&lt;BackendlessFile&gt; -> fileURL: https://api.backendless.com/url.jpeg";
    dpSmall = "&lt;BackendlessFile&gt; -> fileURL: https://api.backendless.com/5url.jpeg";
    email = "indianfemale1@gmail.com";
    fname = "Indian Femle 01";
    gender = 2;
    interested = 1;
    lastLogin = "2016-05-11 07:56:22 +0000";
    lastnameTF = 123;
    launchFirst = 1;
    location =     {
        "___class" = "com.backendless.geo.model.GeoPoint";
        categories =         (
            Default
        );
        distance = 0;
        latitude = "xx.613";
        longitude = "xx.209";
        metadata =         {
        };
        objectId = "98384BEF-085D-3FEB-FF49-D3CDA02B1200";
    };
    locationLimit = 18;
    maxAge = 18;
    minAge = 18;
    name = "indianfemale1@gmail.com";
    nationality = Indian;
    objectId = "D5670FBC-2FEE-20AB-FFF8-A63420934200";
    ownerId = "D5670FBC-2FEE-20AB-FFF8-A63420934200";
    updated = "2016-05-11 07:56:47 +0000";
    userStatus = ENABLED;
}

Same
FAULT = ‘1001’ error here!

So for me , it is another stupid issue coming from backendless side which is causing the issue.
If i upload a geopoint and set it to user, it shows as in log

     location = "&lt;GeoPoint&gt; LAT:xx.613, LON:xx.209, distance:0, CATEGORIES:(\n    Default\n), METADATA:{\n}, objectId = 402B377D-4272-2BE8-FF02-76F461DA7200";

However, closing app and relaunching (having automatic sign in enabled) . next time the location changes to a dictionary

   location =     {
        "___class" = "com.backendless.geo.model.GeoPoint";
        categories =         (
            Default
        );
        distance = 0;
        latitude = "xx.613";
        longitude = "xx.209";
        metadata =         {
        };
        objectId = "402B377D-4272-2BE8-FF02-76F461DA7200";
And the above 1001 error comes now if i use the object in match class. 

Please suggest a fix asap.

What if you try to store a match object with users without the “location” property? Does it work?

Hi Kim, Isabela,

We will check this issue and let you know about a solution.
Internal ticket BKNDLSS-12573 is opened.

Yes @Mark,
It works if i do

    let match = Matches()
        currentLoggedInUser.removeProperty("location");
        forUser.removeProperty("location");
        match.byUser = currentLoggedInUser
        match.toUser = forUser
        match.liked = true
        

This issue is reproduced, we are working to fix it.

This issue is fixed, you could update Backendless SDK from CocoaPods (3.0.22 release) or from github.
We created a sample project (see in an attachment), it demonstrates the fixed SDK functionality.

Please keep in mind, that if you change a current user property, you must update current user object using update method of UserService or PersisitenceService, for example:

    func saveMatchUsersWithLocation() {
        
        Types.tryblock({ () -> Void in
            
            var user = self.backendless.userService.currentUser
            let geoPoint = GeoPoint.geoPoint(GEO_POINT(latitude: 30.35, longitude: 12.64)) as! GeoPoint
            user.setProperty("location", object: geoPoint)
            
            // Isn't enough to change a current user property - then you should update the current user on the server
            user = self.backendless.userService.update(user)
            print("saveCurrentUserWithGeo - User has been updated: \(user) \ncurrentUser -> \(self.backendless.userService.currentUser)")
            },
            catchblock: { (exception) -> Void in
                print("saveCurrentUserWithGeo - Server reported an error: \(exception as! Fault)")
                return
            }
        )
        
        let match = Matches()
        match.byUser = backendless.userService.currentUser
        match.toUser = backendless.userService.currentUser
        match.liked = true
        
        let dataStore = backendless.data.of(Matches.ofClass())
        dataStore.save(
            match,
            response: { (result: AnyObject!) -> Void in
                if let obj = result as? Matches {
                    print("Match has been saved: \(obj.objectId)")
                }
            },
            error: { (fault: Fault!) -> Void in
                print("Server reported an error: \(fault)")
        })
    }

Regards,
Slava

TestUserService.zip (19.26MB)

Thanks, seems to be working now.

same issue in android too … please provide link for the android sdk with this issue fixed

Hi, Karanveer. Please open a separate thread on the issue you encounter and provide stable steps to reproduce the problem a sample of code that reproduces it. Thanks.