Questions tagged [nsbatchdeleterequest]

9 questions
7
votes
3 answers

Using NSFetchedResultsController w/NSBatchDeleteRequest

I'm having an issue getting accurate updates from an NSFetchedResultsControllerDelegate after using an NSBatchDeleteRequest, the changes come through as an update type and not the delete type on the didChange delegate method. Is there a way to get…
4
votes
2 answers

Is NSInMemoryStoreType Incompatible with NSBatchDeleteRequest?

I am currently unit testing a layer that interacts with Core Data. It saves, deletes, and updates an Item object. However, my test that attempts to save a couple of Items and then perform a batch deletion keeps failing. This is Item: extension Item…
Nick Kohrn
  • 5,779
  • 3
  • 29
  • 49
3
votes
1 answer

Why entries are not deleted until app is restarted or I execute my NSBatchDeleteRequest twice?

I'm reading Delete/Reset all entries in Core Data?. If I follow the steps below, I get an unexpected result: Call the code below Then query an entity in the simulator, I will get an entity back!!! If I call clearCoreDataStore again (or do a…
3
votes
1 answer

NSBatchDeleteRequest deletes all child entities

My CoreData model got two child entities "CarA" and "CarB" with the same abstract parent entity "Car". I'm trying to delete all CarA objects using func deleteObjects(entityName: String) { let fetchRequest =…
Paul
  • 272
  • 1
  • 6
2
votes
1 answer

NSBatchDeleteRequest leaving bad relationships

I have a Project object that has a to-many relationship to Image, the delete rules are set up as Cascade for project.images and Nullify for image.project. In this case I need to clear out the attached images but leave the project itself intact.…
trapper
  • 11,716
  • 7
  • 38
  • 82
1
vote
1 answer

NSBatchUpdateRequest not saving Transformable attribute

I have an entity (TestEntity) which contains a "Transformable" attribute which holds an object (MyObjectClass). On initial load, the transformable saves correctly; initialised as below: TestEntity *test = (TestEntity *)[NSEntityDescription…
0
votes
1 answer

List refresh after CoreData deletion

I have View with a list of records from the CoreData entity and there is the following FetchRequest declared in the View @FetchRequest(entity: Locations.entity(), sortDescriptors: [NSSortDescriptor(key: "locTimestamp", ascending: false)]) var…
Dawy
  • 770
  • 6
  • 23
0
votes
2 answers

'NSBatchDeleteRequest' is only available on iOS 9.0 or newer

I am facing this issue 'NSBatchDeleteRequest' is only available on iOS 9.0 or newer class func delete(placeId:Int64) { let context = CoreDataStack.getContext() let fetch = NSFetchRequest(entityName: "Place") …
Varun Naharia
  • 5,318
  • 10
  • 50
  • 84
-1
votes
2 answers

Figuring out what causing a Core Data fault

I keep hitting Core Data faults when updating and deleting objects and Id like to understand why. The logic essentially fetches the entities, updates a few fields and saves. No faults are hit. The entities are then consumed for some business logic…