Would you be able to share the code you've written inside container.loadPersistentStores
I'm in the same situation as you, and my code is pretty much identical, but after I've replaced the persistent store, my app crashes, and I get the error:
"This NSPersistentStoreCoordinator has no persistent stores (unknown). It cannot perform a save operation.".