Could not cast value of type Error

Does anyone know what causing the following error on line “let obj = dataObjects as! [EventsTable]”

Could not cast value of type ‘__NSDictionaryM’ (0x10dd102b0) to ‘FLBackendlessAPI.EventsTable’ (0x10c056ca0).

I seem to be able to retrieve data plus a lot of meta data but the return value won’t cast to my object type

class EventsTable: NSObject {

var enquiries : String?

var ownerId : String?

var created : Date?

var regional_council : String?

var objectId : String?

var visitors : NSNumber?

var start_date : Date?

var end_date : Date?

var visible_in_app : String?

var event : String?

var organisition : String?

var occurrence_name : String?

var push_code : String?

var updated : Date?

var venue_pointer : Address_UK?

var judgedBy : NSMutableArray?

var timetable_pointer : DATA? 

var results_pointer : DATA?

var syllabus_pointer : DATA?


fileprivate func retreiveAllEventDatafromBackendCloud() -> Void {

    let backendless = Backendless.sharedInstance()

    //let eventArray:NSMutableArray = []

    let eventsStorage = backendless?.data.of(EventsTable().ofClass())


    let dataQuery = DataQueryBuilder()





    Types.tryblock({ () -> Void in

        // sychronous backendless API call here

        print("Events have been found:")


        let dataObjects = eventsStorage?.find(dataQuery)




        let obj  = dataObjects as! [EventsTable]





                   catchblock: { (exception) -> Void in

                    // handle error from server here

                    //print("backendless Server reported an error: \(String(describing: error))")


                    DispatchQueue.main.async {

                        self.allEventsCompletionHandler(false, nil)







Hi Jason,

A developer will get back to you with an answer shortly.


Hello Jason,
Please provide your Application ID so we could check this issue.

Regards, Olga

…also it would help a lot if you package the sample code into a minimal project so that we could just run it and test the behaviour.

Closed as “cannot answer” without user’s response.