I am trying to fetch data from core data between a range of 3 days from current date
let timestampToday = Int(Date().timeIntervalSince1970)
let predicate = NSPredicate(format: "timestamp >= %@ AND timestamp < %@", Int(timestampToday - Constants.THREE_DAYS), timestampToday)
let request: NSFetchRequest<HealthKit> = HealthKit.fetchRequest()
do{
request.predicate = predicate
let test = try context.fetch(request)
}catch{ ...}
}
I get an without any description just (lldb) and this line highlighted in red. So it's quite evident that the predicate is the main issue here. What am I doing wrong?