Hi , I am using Couchbase lite Mobile iOS. I added “createdDate” property to my document. I am assigning NSDate to “createdDate” property while creating the document.My problem is app crashes at “let result : CBLQueryEnumerator = try! cblQuery.run()”.Please review my code below which i am using to get documents from data base.
{
let predicate = NSPredicate(format: “documentType == %@ AND createdDate >= %@ AND createdDate <= %@”, argumentArray: [ModelNames.kUserModel,backDate,NSDate()])
let query = try! CBLQueryBuilder(database: database, select: nil, wherePredicate: predicate, orderBy: nil) let cblQuery : CBLQuery = query.createQueryWithContext(nil) cblQuery.descending = true let result : CBLQueryEnumerator = try! cblQuery.run()
}
The data base is giving result if i use the predicate like this(i.e when there is no NSDate property in predicate)
let predicate = NSPredicate(format: “documentType == %@”, argumentArray: [UserModel])
Thanks in Advance.