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 ?? “”)”)
})