when I try to load a related field, I get this error: "*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance"
I feel like it's caused by loading a collection of data that the compiler doesn't know what to do with.
Any help appreciated.
func findPostsInGroup() {
let whereClause = "GroupPostBelongsTo.objectId = 'B52F6BEA-79F8-A58B-FF15-AF840BCB2A00'"
let dataQuery = BackendlessDataQuery()
dataQuery.whereClause = whereClause
print("hey")
var error: Fault?
let posts = self.backendless.persistenceService.find(Posts.ofClass(),
dataQuery:dataQuery) as BackendlessCollection
print("hey")
if error == nil {
for post in posts.data as! [Posts] {
print("post class is \(post.PostText)")
print("post class is \(post.objectId)")
print(post.Author.name)
}
}
else {
print("Server reported an error: \(error)")
}
}
import Foundation
Groups table class definition
class Groups : NSObject{
var groupName: String?
var UsersInGroup = [BackendlessUser]()
var ownerId: String?
var objectId : String?
}
posts.data
value? Does it have something in it? – JellyNSNull
instance (which is the result of anull
somewhere) in place of aString
orNSString
instance. However, it's very difficult to see which line has that problem. It could bepost.Author.name
, for example. – Sulthan