Support Topics Documentation Slack YouTube Blog

Is MobileDevice a keyword? ( or trouble with table mapping)

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

5.x

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

Swift

Expected Behavior

Basic object retrieval by objectId should return a result

Actual Behavior

query will not run. Error is as follows:

“Error: Table not found by name ‘Table not found by name ‘MobileDevicess’. Make sure the client class referenced in the API call has the same literal name as the table in Backendless console’”

I noticed the extra “s” at the end of the object in the error message, so I changed the table mapping to drop the “s”, even though that doesn’t map to a real table, and the query sort of runs, as in it returns a dictionary of [String:Any] objects, which makes no sense.

****Note 1: I have other table -> class mappings that work, so there seems to be something particular about the keyword “MobileDevice”.
****Note 2: I have an Android project that works for this same application, so I don’t believe it’s a keyword, but I can’t understand what is happening.

Reproducible Test Case

Here is the class:
import Foundation

@objcMembers class MobileDevice: NSObject {
var objectId: String?
var email: String?
var customerid: String?
var devicetel: String?
var username: String?
}

Here is the class mapping in AppDelegate:

Backendless.shared.data.of(MobileDevice.self).mapToTable(tableName: “MobileDevices”)

Here is the basic query that is failing:
var mobileDeviceId = “8B6F2628-749C-32A6-FFB9-929556C01D00”
let x = Backendless.shared.data.ofTable(“MobileDevice”)
x.findById(objectId: mobileDeviceId, responseHandler: { foundObject in
print(“Found object: (foundObject as! [String: Any])”)
}, errorHandler: { fault in
print(“Error: (fault.message ?? “”)”)
})

Hello Mark,

I’ve created the internal ticket BKNDLSS-20653 to investigate this issue.

Regards,
Olha

Issue is resolved.
Fix will be available in future release of Swift-SDK at the start of the next week.

Regards,
Olha

Wonderful! When you say it will be available, does that mean it will be on cocoapod and I’ll be able to upgrade from there? I’m currently at 5.7.4.

Thanks so much!

Of course, it will be present on cocoapods.

Regards,
Olha

A new version 5.7.6 is now available.

Regards,
Olha

Thanks, just updated and it’s working! Appreciate the help