Fix a deadlock.
[FIXED] Deadlock when NSUserDefaultsDidChange is handled on the main queue when the main queue is waiting for the persistence queue. [FIXED] Logging of cloudEnabled. [REMOVED] Debug NSLogs.
This commit is contained in:
parent
62076d8170
commit
99a1d505d3
@ -336,9 +336,7 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext,
|
|||||||
|
|
||||||
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager willLoadStoreIsCloud:(BOOL)isCloudStore {
|
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager willLoadStoreIsCloud:(BOOL)isCloudStore {
|
||||||
|
|
||||||
// [manager setValue:@"C61DCF27-BD25-4CF1-AE8F-8B613DF8AB47" forKey:@"storeUUID"];
|
|
||||||
NSManagedObjectContext *moc = [self mainManagedObjectContextIfReady];
|
NSManagedObjectContext *moc = [self mainManagedObjectContextIfReady];
|
||||||
NSLog( @"willLoadStoreIsCloud:%d mainMoc:%@", isCloudStore, moc);
|
|
||||||
[moc performBlockAndWait:^{
|
[moc performBlockAndWait:^{
|
||||||
[moc saveToStore];
|
[moc saveToStore];
|
||||||
|
|
||||||
@ -352,7 +350,6 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext,
|
|||||||
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didLoadStoreForCoordinator:(NSPersistentStoreCoordinator *)coordinator
|
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didLoadStoreForCoordinator:(NSPersistentStoreCoordinator *)coordinator
|
||||||
isCloud:(BOOL)isCloudStore {
|
isCloud:(BOOL)isCloudStore {
|
||||||
|
|
||||||
NSLog( @"didLoadStoreForCoordinatorStores:%d isCloud:%d", [[coordinator persistentStores] count], isCloudStore );
|
|
||||||
inf(@"Using iCloud? %@", @(isCloudStore));
|
inf(@"Using iCloud? %@", @(isCloudStore));
|
||||||
MPCheckpoint( MPCheckpointCloud, @{
|
MPCheckpoint( MPCheckpointCloud, @{
|
||||||
@"enabled" : @(isCloudStore)
|
@"enabled" : @(isCloudStore)
|
||||||
@ -385,7 +382,6 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext,
|
|||||||
|
|
||||||
self.privateManagedObjectContext = privateManagedObjectContext;
|
self.privateManagedObjectContext = privateManagedObjectContext;
|
||||||
self.mainManagedObjectContext = mainManagedObjectContext;
|
self.mainManagedObjectContext = mainManagedObjectContext;
|
||||||
NSLog( @"set mainMoc:%@", mainManagedObjectContext );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreErrorCause)cause
|
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreErrorCause)cause
|
||||||
|
@ -32,9 +32,11 @@
|
|||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserverForName:NSUserDefaultsDidChangeNotification object:nil
|
[[NSNotificationCenter defaultCenter] addObserverForName:NSUserDefaultsDidChangeNotification object:nil
|
||||||
queue:[NSOperationQueue mainQueue] usingBlock:
|
queue:nil usingBlock:
|
||||||
^(NSNotification *note) {
|
^(NSNotification *note) {
|
||||||
|
dispatch_async( dispatch_get_main_queue(), ^{
|
||||||
self.levelControl.selectedSegmentIndex = [[MPiOSConfig get].traceMode boolValue]? 1: 0;
|
self.levelControl.selectedSegmentIndex = [[MPiOSConfig get].traceMode boolValue]? 1: 0;
|
||||||
|
});
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@
|
|||||||
|
|
||||||
#ifdef CRASHLYTICS
|
#ifdef CRASHLYTICS
|
||||||
[[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].rememberLogin boolValue] forKey:@"rememberLogin"];
|
[[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].rememberLogin boolValue] forKey:@"rememberLogin"];
|
||||||
[[Crashlytics sharedInstance] setBoolValue:[self storeManager].cloudEnabled forKey:@"iCloud"];
|
[[Crashlytics sharedInstance] setBoolValue:[[MPiOSConfig get].iCloudEnabled boolValue] forKey:@"iCloudEnabled"];
|
||||||
[[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].iCloudDecided boolValue] forKey:@"iCloudDecided"];
|
[[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].iCloudDecided boolValue] forKey:@"iCloudDecided"];
|
||||||
[[Crashlytics sharedInstance] setBoolValue:[[MPiOSConfig get].sendInfo boolValue] forKey:@"sendInfo"];
|
[[Crashlytics sharedInstance] setBoolValue:[[MPiOSConfig get].sendInfo boolValue] forKey:@"sendInfo"];
|
||||||
[[Crashlytics sharedInstance] setBoolValue:[[MPiOSConfig get].helpHidden boolValue] forKey:@"helpHidden"];
|
[[Crashlytics sharedInstance] setBoolValue:[[MPiOSConfig get].helpHidden boolValue] forKey:@"helpHidden"];
|
||||||
@ -648,8 +648,8 @@
|
|||||||
#ifdef TESTFLIGHT_SDK_VERSION
|
#ifdef TESTFLIGHT_SDK_VERSION
|
||||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPConfig get].rememberLogin )
|
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPConfig get].rememberLogin )
|
||||||
forKey:@"rememberLogin"];
|
forKey:@"rememberLogin"];
|
||||||
[TestFlight addCustomEnvironmentInformation:PearlStringB( [self storeManager].cloudEnabled )
|
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPiOSConfig get].iCloudEnabled )
|
||||||
forKey:@"iCloud"];
|
forKey:@"iCloudEnabled"];
|
||||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPConfig get].iCloudDecided )
|
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPConfig get].iCloudDecided )
|
||||||
forKey:@"iCloudDecided"];
|
forKey:@"iCloudDecided"];
|
||||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPiOSConfig get].sendInfo )
|
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPiOSConfig get].sendInfo )
|
||||||
@ -671,7 +671,7 @@
|
|||||||
#endif
|
#endif
|
||||||
MPCheckpoint( MPCheckpointConfig, @{
|
MPCheckpoint( MPCheckpointConfig, @{
|
||||||
@"rememberLogin" : @([[MPConfig get].rememberLogin boolValue]),
|
@"rememberLogin" : @([[MPConfig get].rememberLogin boolValue]),
|
||||||
@"iCloud" : @([self storeManager].cloudEnabled),
|
@"iCloudEnabled" : @([[MPiOSConfig get].iCloudEnabled boolValue]),
|
||||||
@"iCloudDecided" : @([[MPConfig get].iCloudDecided boolValue]),
|
@"iCloudDecided" : @([[MPConfig get].iCloudDecided boolValue]),
|
||||||
@"sendInfo" : @([[MPiOSConfig get].sendInfo boolValue]),
|
@"sendInfo" : @([[MPiOSConfig get].sendInfo boolValue]),
|
||||||
@"helpHidden" : @([[MPiOSConfig get].helpHidden boolValue]),
|
@"helpHidden" : @([[MPiOSConfig get].helpHidden boolValue]),
|
||||||
|
Loading…
Reference in New Issue
Block a user