Backendless Support
 
Waiting for user's response

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

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.

  1. static func get(name: String) -> City? {
  2. let whereClause = "name = '\(name)'"
  3. let queryBuilder = DataQueryBuilder()
  4. //queryBuilder!.addListRelated(["sectors","location"])
  5. queryBuilder!.setWhereClause(whereClause)
  6. let dataStore = Globals.backendless.data.of(City.ofClass())
  7. var city : City?
  8. Types.tryblock({ () -> Void in
  9. city = dataStore?.findFirst(queryBuilder) as! City?
  10. },
  11. catchblock: { (exception) -> Void in
  12. print(exception)
  13. })
  14. //
  15. // dataStore?.findFirst(queryBuilder, response: {(foundCity) -> () in
  16. // city = foundCity as? City
  17. // }, error: {(fault: Fault?) -> () in
  18. // print(String(describing: fault))
  19. // })
  20. return city
  21. }

Best Answer
photo

This problem is fixed. Please update to the new version of iOS-SDK 4.0.16 and verify wether everything works fine now. Also please notice, that the findFirst/findLast methods with DataQueryBuilder don't process the whereClause query. They process only "related", "relationsDepth" and "properties"of DataQueryBuilder.

Regards, Olga

Leave a Comment

Comments (4)

photo
1

Hello,

please provide your app id.

Regards, Olga

photo
1

3694DC88-F7D2-CE48-FFD3-60760A63BF00

photo
photo
2

This problem is fixed. Please update to the new version of iOS-SDK 4.0.16 and verify wether everything works fine now. Also please notice, that the findFirst/findLast methods with DataQueryBuilder don't process the whereClause query. They process only "related", "relationsDepth" and "properties"of DataQueryBuilder.

Regards, Olga

photo
1

Just tested and it’s working.

Thank you very much!

photo