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

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -