从核心数据中删除信息

问题描述:

我有一个应用程序,可以在应用程序加载后从我的Web服务中解析所有数据,但是我想添加一个IBACTION(按钮),它将删除coredata中的所有数据并重新分析该信息(因此更新数据库) - 就像刷新按钮。从核心数据中删除信息

调用解析方法是:使用内建

- (void)getRssData 
{ 
    self.webServiceAndParser = [[LukesParser alloc] initWithDelegate:self]; 
    [self.webServiceAndParser getAllData]; 
} 

核心数据的方法IM在我取结果控制的对象是:

- (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(); 
    } 
} 

什么想法?

如果您要删除全部核心数据持久性存储中的数据,请参阅Delete/Reset all entries in Core Data?以获取一些可能的方法。