2
0

Update of iOS code for updated API of UbiquityStoreManager.

[UPDATED]   UbiquityStoreManager's new API uses cloudEnabled instead of iCloudEnabled.
This commit is contained in:
Maarten Billemont 2013-01-27 00:54:54 -05:00
parent d5bffd86d6
commit ecd03ecf42
8 changed files with 47 additions and 58 deletions

View File

@ -26,9 +26,9 @@
* *
**/ **/
#ifdef DEBUG #ifdef DEBUG
#define CLS_LOG(__FORMAT__, ...) CLSNSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) #define CLS_LOG(__FORMAT__, ...) CLSNSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else #else
#define CLS_LOG(__FORMAT__, ...) CLSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) #define CLS_LOG(__FORMAT__, ...) CLSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif #endif
/** /**
@ -37,7 +37,7 @@
* and will only be visible in your Crashlytics dashboard. * and will only be visible in your Crashlytics dashboard.
* *
**/ **/
OBJC_EXTERN void CLSLog(NSString *format, ...); OBJC_EXTERN void CLSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
/** /**
* *
@ -45,22 +45,11 @@ OBJC_EXTERN void CLSLog(NSString *format, ...);
* and your Crashlytics dashboard. It is not recommended for Release builds. * and your Crashlytics dashboard. It is not recommended for Release builds.
* *
**/ **/
OBJC_EXTERN void CLSNSLog(NSString *format, ...); OBJC_EXTERN void CLSNSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
@protocol CrashlyticsDelegate; @protocol CrashlyticsDelegate;
@interface Crashlytics : NSObject { @interface Crashlytics : NSObject
@private
NSString *_apiKey;
NSString *_dataDirectory;
NSString *_bundleIdentifier;
BOOL _installed;
NSMutableDictionary *_customAttributes;
id _user;
NSInteger _sendButtonIndex;
NSInteger _alwaysSendButtonIndex;
NSObject <CrashlyticsDelegate> *_delegate;
}
@property (nonatomic, readonly, copy) NSString *apiKey; @property (nonatomic, readonly, copy) NSString *apiKey;
@property (nonatomic, readonly, copy) NSString *version; @property (nonatomic, readonly, copy) NSString *version;
@ -154,7 +143,7 @@ OBJC_EXTERN void CLSNSLog(NSString *format, ...);
* them or copy them. * them or copy them.
**/ **/
@protocol CLSCrashReport <NSObject> @protocol CLSCrashReport <NSObject>
@optional @required
/** /**
* Returns the session identifier for the crash report. * Returns the session identifier for the crash report.

Binary file not shown.

@ -1 +1 @@
Subproject commit 8faba0d3c35d471005c45280dc2670bc811e08c6 Subproject commit b748092775b2ee07c4c494434b43c72fb589ab67

View File

@ -203,11 +203,11 @@ static char managedObjectContextKey;
dbg(@"[StoreManager] %@", message); dbg(@"[StoreManager] %@", message);
} }
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToiCloud:(BOOL)iCloudEnabled { - (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToCloud:(BOOL)cloudEnabled {
// manager.cloudEnabled is more reliable (eg. iOS' MPAppDelegate tampers with didSwitch a bit) // manager.cloudEnabled is more reliable (eg. iOS' MPAppDelegate tampers with didSwitch a bit)
iCloudEnabled = manager.cloudEnabled; cloudEnabled = manager.cloudEnabled;
inf(@"Using iCloud? %@", iCloudEnabled? @"YES": @"NO"); inf(@"Using iCloud? %@", cloudEnabled? @"YES": @"NO");
#ifdef TESTFLIGHT_SDK_VERSION #ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:cloudEnabled? MPCheckpointCloudEnabled: MPCheckpointCloudDisabled]; [TestFlight passCheckpoint:cloudEnabled? MPCheckpointCloudEnabled: MPCheckpointCloudDisabled];
@ -218,7 +218,7 @@ static char managedObjectContextKey;
}]; }];
#endif #endif
[MPConfig get].iCloud = @(iCloudEnabled); [MPConfig get].iCloud = @(cloudEnabled);
} }
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause - (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause

View File

@ -395,8 +395,8 @@
- (void)checkConfig { - (void)checkConfig {
if ([[MPConfig get].iCloud boolValue] != [self.storeManager iCloudEnabled]) if ([[MPConfig get].iCloud boolValue] != [self.storeManager cloudEnabled])
[self.storeManager useiCloudStore:[[MPConfig get].iCloud boolValue] alertUser:YES]; self.storeManager.cloudEnabled = [[MPConfig get].iCloud boolValue];
if ([[MPiOSConfig get].sendInfo boolValue]) { if ([[MPiOSConfig get].sendInfo boolValue]) {
if ([PearlLogger get].printLevel > PearlLogLevelInfo) if ([PearlLogger get].printLevel > PearlLogLevelInfo)
[PearlLogger get].printLevel = PearlLogLevelInfo; [PearlLogger get].printLevel = PearlLogLevelInfo;
@ -629,12 +629,12 @@
#pragma mark - UbiquityStoreManagerDelegate #pragma mark - UbiquityStoreManagerDelegate
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToiCloud:(BOOL)iCloudEnabled { - (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToCloud:(BOOL)cloudEnabled {
[super ubiquityStoreManager:manager didSwitchToiCloud:iCloudEnabled]; [super ubiquityStoreManager:manager didSwitchToCloud:cloudEnabled];
if (![[MPConfig get].iCloudDecided boolValue]) { if (![[MPConfig get].iCloudDecided boolValue]) {
if (!iCloudEnabled) { if (!cloudEnabled) {
[PearlAlert showAlertWithTitle:@"iCloud" [PearlAlert showAlertWithTitle:@"iCloud"
message: message:
@"iCloud is now disabled.\n\n" @"iCloud is now disabled.\n\n"
@ -657,7 +657,7 @@
@"Apple can never see any of your passwords." @"Apple can never see any of your passwords."
viewStyle:UIAlertViewStyleDefault viewStyle:UIAlertViewStyleDefault
initAlert:nil tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) { initAlert:nil tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) {
[self ubiquityStoreManager:manager didSwitchToiCloud:iCloudEnabled]; [self ubiquityStoreManager:manager didSwitchToCloud:cloudEnabled];
} }
cancelTitle:[PearlStrings get].commonButtonThanks otherTitles:nil]; cancelTitle:[PearlStrings get].commonButtonThanks otherTitles:nil];
return; return;
@ -667,7 +667,7 @@
if (buttonIndex == [alert cancelButtonIndex]) if (buttonIndex == [alert cancelButtonIndex])
return; return;
if (buttonIndex == [alert firstOtherButtonIndex] + 1) if (buttonIndex == [alert firstOtherButtonIndex] + 1)
[manager useiCloudStore:YES alertUser:NO]; manager.cloudEnabled = YES;
} cancelTitle:@"Leave iCloud Off" otherTitles:@"Explain?", @"Enable iCloud", nil]; } cancelTitle:@"Leave iCloud Off" otherTitles:@"Explain?", @"Enable iCloud", nil];
} }
} }

View File

@ -164,14 +164,14 @@
[self initializeWordLabel:wordLabel]; [self initializeWordLabel:wordLabel];
} recurse:NO]; } recurse:NO];
[[NSNotificationCenter defaultCenter] addObserverForName:PersistentStoreDidChange object:nil queue:nil usingBlock: [[NSNotificationCenter defaultCenter] addObserverForName:UbiquityManagedStoreDidChangeNotification object:nil queue:nil
^(NSNotification *note) { usingBlock:^(NSNotification *note) {
[self updateUsers]; [self updateUsers];
}]; }];
[[NSNotificationCenter defaultCenter] addObserverForName:PersistentStoreDidMergeChanges object:nil queue:nil usingBlock: [[NSNotificationCenter defaultCenter] addObserverForName:UbiquityManagedStoreDidImportChangesNotification object:nil queue:nil
^(NSNotification *note) { usingBlock:^(NSNotification *note) {
[self updateUsers]; [self updateUsers];
}]; }];
[self updateLayoutAnimated:NO allowScroll:YES completion:nil]; [self updateLayoutAnimated:NO allowScroll:YES completion:nil];