I have a app that parses all my data from my web service as soon as the app is loaded however I want to add an IBACTION (Button) that will delete all of the data from the coredata and reparse the information (therefore updating the data base) - like a Refresh Button.
The Method that call the parsing is:
- (void)getRssData
{
self.webServiceAndParser = [[LukesParser alloc] initWithDelegate:self];
[self.webServiceAndParser getAllData];
}
The core data method im using the build the object in my fetch results controller is:
- (void)insertNewObject
{
// Create a new instance of the entity managed by the fetched results controller.
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity];
NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context];
[newManagedObject setValue:[NSDate date] forKey:@"timeStamp"];
// Save the context.
NSError *error = nil;
if (![context save:&error])
{
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
}
any ideas?