Support Topics Documentation Slack YouTube Blog

Attempt to insert nil object from objects[n] when using DataQueryBuilder


(Vlad Kolegov) #1

I’m getting

*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[2]

exception when trying to retrieve data using DataQueryBuilder.
In case of using findFirst() without DQB it gets data just fine.
Problem occurred after updating to 4th version of backendless.

static func get(name: String) -> City? {



 let whereClause = "name = '\(name)'"
 let queryBuilder = DataQueryBuilder()



 //queryBuilder!.addListRelated(["sectors","location"])
 queryBuilder!.setWhereClause(whereClause)



 let dataStore = Globals.backendless.data.of(City.ofClass())



 var city : City?



 Types.tryblock({ () -> Void in
 city = dataStore?.findFirst(queryBuilder) as! City?
 },
 catchblock: { (exception) -> Void in
 print(exception)
 })
//
// dataStore?.findFirst(queryBuilder, response: {(foundCity) -> () in
// city = foundCity as? City
// }, error: {(fault: Fault?) -> () in
// print(String(describing: fault))
// })



 return city
 }




(Olha Danylova) #2

Hello,

please provide your app id.

Regards, Olga