Beginners Question about Core Data fetchRequest

Discussion in 'iOS Programming' started by Glama, Aug 12, 2009.

  1. Glama macrumors member

    Joined:
    Feb 5, 2009
    #1
    Hello!
    I am trying to follow Apple's guide to Core Data. In one of their sample programs, they have this code:

    Code:
    NSManagedObjectModel *model = ...;
    
    NSError *error;
    
    NSDictionary *substitutionDictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"Fiona", @"FIRST_NAME", @"Verde", @"LAST_NAME", [NSDate dateWithTimeIntervalSinceNow:-31356000], @"DATE", nil];
    NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"PublicationsForAuthorSinceDate" substitutionVariables:substitutionDictionary];
    
    NSArray *results = [aManagedObjectContext executeFetchRequest:fetchRequest error:&error];
    
    I dont even know if this code is reading from the store or writing to it. It seems like a "fetch" would be for reading, but data values are specified (hard coded) so it must be writing it. Am I correct?
     
  2. doanelinde macrumors member

    Joined:
    Jul 24, 2009

Share This Page