Saving an object in Swift 3 saves empty object in Backendless

Having moved a project to Swift 3 and setting up classes as inheriting from NSObject and not Backendless, as we did in the past. When I save the object async to the server, I end up with an empty line. None of the data gets across.
Is there anyone that can see what is going on?
Apologies for having to zip the file up, was wasn’t allowed to attach the .swift file.

BodyTrack copy.swift.zip (2.56kB)

Hello Jorgen

Our iOS developer will contact you regarding the results of your code analysis. You may reference it by id 14126.
Thanks for patience.

Regards Anton

Hi Jorgen,

Please note that the fields of types Bool, Int, Double and Float cannot be declared optional. See the note in the documentation (bottom of the page):
https://backendless.com/documentation/data/ios/data_data_object.htm

Could you please make the change and try again?

Regards,
Mark

Hello Jorgen,
BodyTrack properties should be initialised like

class BodyTrack: NSObject {    
    var trackingDate:   Date?
    var chest           = 0.0
    var upperArm        = 0.0
    var waist           = 0.0
    var hip             = 0.0
    var thigh           = 0.0
    var weight          = 0.0
    var bodyFat         = 0.0
    var fatFreeMass     = 0.0
    var totalBodyWater  = 0.0
    var bodyMassFat     = 0.0
    var smm             = 0.0
    
    var objectId:       String?
    var created:        Date?
    var updated:        Date?
}

with no init() method overriding. Everything works fine then.

Regards,
Olga

Thanks Olga. That fixed other classes I had problem with as well.

Hi Olga.

This problem is occurring on:

pod 'Backendless', '4.0.2'

To test it I’m using the same ‘BodyTrack’ class you post above.
The ‘Enable dynamic schema definition’ feature is enable in the console page.

In my case the ‘BodyTrack’ class is created successfully in the console but the columns and the values are not created.

I’m using Swift in XCode 9.

Hi Felipe,

Please create a dedicated topic for your problem.