ios - How to find the maximum value of date stored in coredata? -


I have created a unit coredata and it is a feature of the date. So, I can get the maximum price of the date.

  NSString * yourEntityName = @ "entity"; NSString * yourDateAttributeName = @ "" date "; NSFetchRequest * fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription * entity = [NSEntityDescription EntityForName: YourEntityNameManagedObjectContext: ctx]; [FetchRequest Set Entity: Entity]; [FetchRequest Setprocertoffet: @ [yourDateAttributeName ]]; [FetchRequest Setfet limit: 1]; // edit the sort key, as appropriate NSSortDescriptor * sortDescriptor = [[NSSortDescriptor alloc] initWithKey: yourDateAttributeName ascending: No]; Ansaarara * Sortdisiptrrs = @ [Sortdeskriptr]; [FetchRequest Setsrtsnshlekar: Sort descriptor]; NSError * error = Null; NSArray * result = [ctx executeFetchRequest: fetchRequest error: & amp; error]; NSManagedObject * yourEntityObject = [results first object]; Ansdit * date = [your Intitiobajm Manaforki: yourDateAttributeName];  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -