For example, if you create an entity called "Data" in CoreData, you can use
Suppose you create Type:Date Attribute, "day" in it.
And when I tried to pull the day for a particular date (I will ignore the time), I got the following code:
let appDel: AppDelegate=UIApplication.sharedApplication().delegate as!AppDelegate
Let PersonContext: NSManagedObjectContext=appDel.managedObjectContext!
let PersonRequest: NSFetchRequest=NSFetchRequest(entityName: "Data")
PersonRequest.returnsObjectsAsFaults=false
let predict = NSPredicate(format: "%K=???"", "day", ????)
PersonRequest.predicate=predicate
var results:NSArray!=PersonContext.executeFetchRequest(PersonRequest, error:nil)</code>
In the letter prediction in the fifth line, what kind of code should I type in the ???? section?
I'm at a loss because I don't know if I should search for the desired date.
How can I pull a specific date from the entity?
It may be insufficient explanation, but if anyone understands, please explain.
swift coredata
let calendar:NSCalendar!=NSCalendar(identifier:NSCalendarIdentifierGregorian)
let targetDay: NSDate!= calendar.dateWithEra (1, year: 2015, month:5, day:12, hour:0, minute:0, second:0, nanosecond:0)
let predict = NSPredicate(format: "SELF.day BETWEEN{%@,%@}", targetedDay, NSDate(timeInterval: 24*60*60-1, sinceDate: targetedDay))
For example, you can create a specific NSDate
and take the next 24 hours - 1 second in BETWEEN
. You can use SELF.day
for day
.
If you have data up to milliseconds, you should use SELF.day>=%@ANDSELF.day<%@
to determine the exact duration.
568 Who developed the "avformat-59.dll" that comes with FFmpeg?
599 GDB gets version error when attempting to debug with the Presense SDK (IDE)
567 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
887 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.