[NSNull length]: unrecognized selector

Hi
I’m trying to migrate over from parse and within 5 minutes i’ve hit my first problem. For some reason my code crashes with [NSNull length]: unrecognised selector. The crash seem to happen on columns with empty data.

Any Ideas welcome

class Events : NSObject
{
var event_id: String?
var event: String?
var organisation: String?
var occurrence_name: String?
var date_start: NSDate?
var date_end: NSDate?
var region: String?
var results_id: String?
var syllabus_id: String?
var visitors: Int = 0

}

func retreiveAllEventDatafromBackendCloud() -> Void {

        let dataStore = backendless.data.of(Events.ofClass())

        var error: Fault?

        

        let result = dataStore.findFault(&error)

        if error == nil {

            let contacts = result.getCurrentPage()

            for obj in contacts {

                print("\(obj.event_id)")

                print("\(obj.event)")

                if obj.organisation != nil {

                    print("\(obj.organisation)")    

                }

            }

        }

        else {

            print("Server reported an error: \(error)")

        }

}

nil
Optional(“Ceim Oir Feis”)
2016-05-04 19:58:55.751 FLBackendlessAPI[9353:425181] -[NSNull length]: unrecognized selector sent to instance 0x102c92d80

2016-05-04 19:58:55.755 FLBackendlessAPI[9353:425181] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[NSNull length]: unrecognized selector sent to instance 0x102c92d80’

Kind Regards

Jason

Hi Jason,

It looks like it failed after the result was delivered to your code. Does it mean the actual error is somewhere in your code then?

Regards,
Mark

Hi Mark,

Thanks for your comment, i did in fact remove the record and it appears to work without an error, using the same code.

What i’m also seeing, is that data uploaded from parse seems to be handled differently than data created within the Web interface.

Parse data is coming through as nil, when data is present in the table.

I’ve created columns through the UI and it appears to work fine

Any ideas?

Hi Jason,

Could you please let me know the following so I can try reproducing the problem:

    Your app id Name of the table where you have an object from Parse value of objectId for the object in question
Thanks, Mark

Hi Mark,
Thanks for your response, my app id is Feis_Log, the table i’m accessing is named Events. hopefully you’ll be able to see that some columns which have been imported from parse have data for example end_date but trying to access these returns nil. whereas i’ve added a “MyDate” column through the interface which appears to be the same returns actual values.

Any ideas?

http://support.backendless.com/public/attachments/f917e9dd88b3895bed4f80a5c7cde8f5.png</img>

obj.Name=nil

obj.Address=nil

obj.MyDate=Optional(2016-05-23 23:00:00 +0000)

obj.date_end=nil

obj.eventId=nil

obj.event=Optional(“Kelley O’Boyle”)

obj.organisation=Optional(“SERC”)

obj.datestart=nil

obj.date_end=nil

obj.results_id=nil

obj.syllabus_id=nil

obj.visitors=4556881280

Hi Jason,

“Feis_Log” is the application name. App ID can be found in Console on the Manage > App Settings screen.

Regards,
Mark

Hi Mark,

Sorry about that, my App Id is as follows
9F813F65-83EB-E76B-FF72-AB683DF7E000

Thanks

Jaso