CardinalKit
CardinalKit copied to clipboard
CoreData throws exception when withdrawing and trying to log in again
Describe the bug When withdrawing from the study and attempting to log in again, Core Data throws an exception and the app crashes.
CoreData: error: Illegal attempt to save to a file that was never opened. "This NSPersistentStoreCoordinator has no persistent stores (unknown)
To Reproduce Steps to reproduce the behavior:
- Log in to CardinalKit
- Choose "Withdraw from Study" on the "Profile" tab and confirm your withdrawal on the following screen.
- Once returns to the login screen, choose "Login Existing User" and log in.
Expected behavior The app should not crash.
Screenshots N/A
Smartphone (please complete the following information):
- Device: Simulator
- OS: iOS 15.5
Additional context This does not occur if the app is deleted and reinstalled after withdrawing.
This issue appears to be originating from CKCareKitManager.shared.wipe() which is called upon opting to withdraw.