diff --git a/External/iCloudStoreManager b/External/iCloudStoreManager index b456a349..71cfb8f4 160000 --- a/External/iCloudStoreManager +++ b/External/iCloudStoreManager @@ -1 +1 @@ -Subproject commit b456a34975e65fba8e2228b790706d852188ecb2 +Subproject commit 71cfb8f4e21a536f5d88a69401f02eeaf1c0a89f diff --git a/MasterPassword/MPAppDelegate_Store.m b/MasterPassword/MPAppDelegate_Store.m index 51ee7a15..3bbbf35d 100644 --- a/MasterPassword/MPAppDelegate_Store.m +++ b/MasterPassword/MPAppDelegate_Store.m @@ -181,11 +181,6 @@ static NSDateFormatter *rfc3339DateFormatter = nil; dbg(@"StoreManager: %@", message); } -- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause context:(id)context { - - err(@"StoreManager: cause=%d, context=%@, error=%@", cause, context, error); -} - #pragma mark - Import / Export - (void)loadRFC3339DateFormatter { diff --git a/MasterPassword/iOS/MPAppDelegate.m b/MasterPassword/iOS/MPAppDelegate.m index f281dbd2..7ad5fbd3 100644 --- a/MasterPassword/iOS/MPAppDelegate.m +++ b/MasterPassword/iOS/MPAppDelegate.m @@ -396,30 +396,32 @@ #pragma mark - UbiquityStoreManagerDelegate +- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToiCloud:(BOOL)didSwitch { + + inf(@"didSwitchToiCloud: %d", didSwitch); +} + - (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause context:(id)context { err(@"StoreManager: cause=%d, context=%@, error=%@", cause, context, error); switch (cause) { case UbiquityStoreManagerErrorCauseDeleteStore: + case UbiquityStoreManagerErrorCauseDeleteLogs: case UbiquityStoreManagerErrorCauseCreateStorePath: case UbiquityStoreManagerErrorCauseClearStore: break; case UbiquityStoreManagerErrorCauseOpenLocalStore: { - [PearlAlert showError:@"Could not open your local database.\n\n" - @"The database may be too old. It will be deleted, the application will quit, " - @"and on the next launch a fresh database will be created." tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) { - wrn(@"Local store could not be opened, deleting it."); - [[NSFileManager defaultManager] removeItemAtURL:context error:nil]; - exit(0); - } otherTitles:nil]; + wrn(@"Local store could not be opened, resetting it."); + manager.hardResetEnabled = YES; + [manager hardResetLocalStorage]; + exit(1); break; } case UbiquityStoreManagerErrorCauseOpenCloudStore: { - [PearlAlert showError:@"Could not use iCloud-synced storage. Will use a local database for now.\n\n" - @"If this problem persists, you may need to reset your Master Password database on iCloud."]; - wrn(@"iCloud store could not be opened, moving to local store."); - [manager useiCloudStore:NO alertUser:NO]; + wrn(@"iCloud store could not be opened, resetting it."); + manager.hardResetEnabled = YES; + [manager hardResetCloudStorage]; break; } }