2
0

Explicitly synchronize configuration updates and warn if it fails.

This commit is contained in:
Maarten Billemont 2014-10-24 00:35:05 -04:00
parent 84c23fa7f6
commit e837752777
7 changed files with 14 additions and 2 deletions

View File

@ -169,6 +169,8 @@ PearlAssociatedObjectProperty( NSMutableArray*, ProductObservers, productObserve
for (id<MPInAppDelegate> productObserver in self.productObservers) for (id<MPInAppDelegate> productObserver in self.productObservers)
[productObserver updateWithTransaction:transaction]; [productObserver updateWithTransaction:transaction];
} }
if (![[NSUserDefaults standardUserDefaults] synchronize])
wrn( @"Couldn't synchronize after transaction updates." );
} }
- (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error { - (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error {

View File

@ -328,6 +328,8 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted );
[[NSUserDefaults standardUserDefaults] setInteger:MPStoreMigrationLevelCurrent forKey:MPStoreMigrationLevelKey]; [[NSUserDefaults standardUserDefaults] setInteger:MPStoreMigrationLevelCurrent forKey:MPStoreMigrationLevelKey];
inf( @"Successfully migrated old to new local store." ); inf( @"Successfully migrated old to new local store." );
if (![[NSUserDefaults standardUserDefaults] synchronize])
wrn( @"Couldn't synchronize after store migration." );
} }
- (BOOL)migrateV1LocalStore { - (BOOL)migrateV1LocalStore {

View File

@ -99,6 +99,8 @@
- (void)setCoached:(BOOL)coached { - (void)setCoached:(BOOL)coached {
[[NSUserDefaults standardUserDefaults] setBool:coached forKey:strf( @"%@.%ld.coached", self.coachedClass, (long)self.coachedVersion )]; [[NSUserDefaults standardUserDefaults] setBool:coached forKey:strf( @"%@.%ld.coached", self.coachedClass, (long)self.coachedVersion )];
if (![[NSUserDefaults standardUserDefaults] synchronize])
wrn( @"Couldn't synchronize after coachmark updates." );
} }
@end @end

View File

@ -32,6 +32,8 @@
inf( @"Preferences will appear" ); inf( @"Preferences will appear" );
[super viewWillAppear:animated]; [super viewWillAppear:animated];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"tipped.passwordsPreferences"]; [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"tipped.passwordsPreferences"];
if (![[NSUserDefaults standardUserDefaults] synchronize])
wrn( @"Couldn't synchronize after preferences appearance." );
MPUserEntity *activeUser = [[MPiOSAppDelegate get] activeUserForMainThread]; MPUserEntity *activeUser = [[MPiOSAppDelegate get] activeUserForMainThread];
self.generatedTypeControl.selectedSegmentIndex = [self generatedSegmentIndexForType:activeUser.defaultType]; self.generatedTypeControl.selectedSegmentIndex = [self generatedSegmentIndexForType:activeUser.defaultType];

View File

@ -37,6 +37,8 @@ PearlEnum( MPDevelopmentFuelConsumption,
return nil; return nil;
[[NSUserDefaults standardUserDefaults] setInteger:storeVersion forKey:@"storeVersion"]; [[NSUserDefaults standardUserDefaults] setInteger:storeVersion forKey:@"storeVersion"];
if (![[NSUserDefaults standardUserDefaults] synchronize])
wrn( @"Couldn't synchronize store version update." );
return features; return features;
} }

View File

@ -50,8 +50,11 @@
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType { navigationType:(UIWebViewNavigationType)navigationType {
if ([[request.URL absoluteString] rangeOfString:@"thanks.lhunath.com"].location != NSNotFound) if ([[request.URL absoluteString] rangeOfString:@"thanks.lhunath.com"].location != NSNotFound) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"tipped.thanks"]; [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"tipped.thanks"];
if (![[NSUserDefaults standardUserDefaults] synchronize])
wrn( @"Couldn't synchronize thanks tip." );
}
if ([request.URL isEqual:request.mainDocumentURL]) { if ([request.URL isEqual:request.mainDocumentURL]) {
self.webNavigationItem.title = request.URL.host; self.webNavigationItem.title = request.URL.host;

View File

@ -1,7 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# See https://developer.apple.com/library/ios/qa/qa1686/_index.html # See https://developer.apple.com/library/ios/qa/qa1686/_index.html
cd "${BASH_SOURCE%/*}" cd "${BASH_SOURCE%/*}"
set -x
source bashlib source bashlib
cd .. cd ..