Im trying to fetch all the objects in an entity matching a user selectedDate (it\'s an NSDate). The Core Data code is fine but my predicate keeps returning 0 results, the da
I can get working with some modifications to the accepted answer and using the iOS 8 API for create dates with time offset. The code:
NSCalendar *calendar = [[FFSharedCalendar singleton] getGregorianCalendar];
NSDate *startOfDay = [calendar dateBySettingHour:0 minute:0 second:0 ofDate:[NSDate date] options:0];
NSDate *endOfDay = [calendar dateBySettingHour:23 minute:59 second:59 ofDate:[NSDate date] options:0];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"createdAt > %@ AND createdAt < %@", startOfDay, endOfDay];
NSArray* plans = [Plan MR_findAllWithPredicate:predicate];
Hope it helps someone