How to remove a core data persistent store

后端 未结 3 1025
终归单人心
终归单人心 2021-02-06 10:19

I need to delete my persistent store (doing it object by object is not practical because I have over 100,000 objects). I\'ve tried this:

- (IBAction)resetDatabas         


        
3条回答
  •  无人及你
    2021-02-06 10:53

    You can do it externally given that you only need to do this while developing your application. I have a terminal open in which I remove the store manually before re-running my app. All you need to know is where it is located. I log it to console everytime my app runs with the following code:

    [[CoreDataSingleton sharedManager] managedObjectContext]; //be sure to create the store first!
    
    //Find targeted mom file in the Resources directory
    NSString *momPath = [[NSBundle mainBundle] pathForResource:@"Parking" ofType:@"mom"];
    NSLog(@"momd path: %@",momPath);
    

    Hope that helps!

提交回复
热议问题