Questions tagged [nspersistentcontainer]

25 questions
1
vote
1 answer

NSPersistentContainer, performBackgroundTask, calling perform does nothing

I'm just started working on a new project and thought I'd try out Core Data's NSPersistentContainer instead of writing my own stack. I just stumbled upon this issue where calling the perform method of the managedObjectContext actually does nothing…
XCool
  • 976
  • 11
  • 32
0
votes
2 answers

Swift Core Data - Change location of persistent store

I have a swift program that reads CSV files and saves the data to a core data persistent store. I would like to change the location of the persistent store. Per Apple documentation it appears that I should be able to do so by overriding the…
Chris
  • 105
  • 8
0
votes
0 answers

Adding a NSPersistentContainer in a existing project

How do I add a NSPersistentContainer in a existing project in xcode?
0
votes
0 answers

How to replace CoreData + CloudKit to only CoreData

My app's database uses CoreData + CloudKit, but I want to remove CloudKit and use only local CoreData. I run the app after replacing NSPersistentCloudKitContainer to NSPersistentContainer, but failed to load persistant stores. How to result this…
junya
  • 1
0
votes
0 answers

I have commented saveContext part still it gets saved in coredata and is displaying the saved data. It checks for email validation but saves anyways

let email = capgEmailTextField.text func isEmailValid(str :String) -> Bool { let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z]+\\.[A-Za-z]{2,4}" let testMail = NSPredicate(format : "SELF MATCHES %@", emailRegEx) return…
0
votes
0 answers

Update Collection View after saving a new entity to Core Data

I am having difficulties updating the collection view, after saving new entity object to persisentContainer. I have to reload the application to see the new data. Ive read similar questions, but they don't appear to be having the same issue that i'm…
0
votes
1 answer

Save managed object changes in background with NSPersistentContainer

I read in a few places (like a high score answer here) that it's good pratice to make main managed context child of a background manaaged context to save save() time and improve UI responsiveness. Persistent Store Coordinator ↑ Managed…
rayx
  • 1,329
  • 10
  • 23
0
votes
0 answers

Core Data deleted when I changed the container destination

I had been using core data for a long time in my app, with the standard setup, but when I changed the NSPersistentContainer, everything was deleted. I expected that the new NSPersistentContainer would be empty, but then when I went back to the…
TimWhiting
  • 2,405
  • 5
  • 21
  • 41
0
votes
1 answer

Migrate Objective-C Core Data to Swift Persistent Container

When Apple added the new PersistentContainer class, they changed the location of the data stores. That means that if you add a new PersistentContainer, it won't pick up the current database but create one. The underlying issue is that the new store…
Cristian Pena
  • 2,139
  • 1
  • 19
  • 31
-1
votes
1 answer

Why does Xcode says "Cannot find type 'NSPersistentContainer' in scope"?

I just stared making a new Core Data project but without making any changes yet, I am getting this error. Not sure why.
Suraj Singh
  • 3
  • 1
  • 2
1
2