daily pastebin goal
21%
SHARE
TWEET

Untitled

a guest Feb 23rd, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Employees<->>ClockPunches
  2.    
  3. NSFetchRequest* request = [Registration fetchRequest];
  4. NSExpression *date = [NSExpression expressionForKeyPath:@"time"];
  5.  
  6. NSExpression *maxDate = [NSExpression expressionForFunction:@"max:"
  7.                                                   arguments:[NSArray arrayWithObject:date]];
  8.  
  9. NSExpressionDescription *d = [[[NSExpressionDescription alloc] init] autorelease];
  10. [d setName:@"maxTime"];
  11. [d setExpression:maxDate];
  12. [d setExpressionResultType:NSDateAttributeType];
  13. [request setPropertiesToFetch:[NSArray arrayWithObject:d]];
  14.  
  15. NSError *error = nil;
  16. NSArray *objects = [Registration executeFetchRequest:request];
  17. if (objects == nil) {
  18.     // Handle the error.
  19. } else {
  20.     if (0 < [objects count]) {
  21.         NSLog(@"Maximum date: %@", [[objects objectAtIndex:0] valueForKey:@"type"]);
  22.     }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top