2
0

TestFligt identifier + Localytics crash.

[IMPROVED]  Use correct device identifier for TestFlight depending on
            whether we're in AdHoc mode or not.
[FIXED]     Crash when sending nil config values to Localytics.
This commit is contained in:
Maarten Billemont 2012-09-21 10:26:53 +02:00
parent 52b8033c37
commit e8c00296bd
2 changed files with 29 additions and 35 deletions

View File

@ -5310,7 +5310,7 @@
"\"$(SRCROOT)/External/Pearl/Pearl-Crypto\"", "\"$(SRCROOT)/External/Pearl/Pearl-Crypto\"",
"\"$(SRCROOT)/External/google-plus-ios-sdk/lib\"", "\"$(SRCROOT)/External/google-plus-ios-sdk/lib\"",
); );
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "1D59446F-0568-458A-96A3-B4226BC94A20"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = "E0621374-3E4C-483D-A3F3-46D151712A4F";
SKIP_INSTALL = NO; SKIP_INSTALL = NO;
TARGETED_DEVICE_FAMILY = 1; TARGETED_DEVICE_FAMILY = 1;
}; };

View File

@ -59,14 +59,17 @@
NSString *testFlightToken = [self testFlightToken]; NSString *testFlightToken = [self testFlightToken];
if ([testFlightToken length]) { if ([testFlightToken length]) {
inf(@"Initializing TestFlight"); inf(@"Initializing TestFlight");
#ifdef ADHOC
[TestFlight setDeviceIdentifier:[(id)[UIDevice currentDevice] uniqueIdentifier]]; [TestFlight setDeviceIdentifier:[(id)[UIDevice currentDevice] uniqueIdentifier]];
//[TestFlight setDeviceIdentifier[PearlKeyChain deviceIdentifier]]; #else
[TestFlight setDeviceIdentifier:[PearlKeyChain deviceIdentifier]];
#endif
[TestFlight addCustomEnvironmentInformation:@"Anonymous" forKey:@"username"]; [TestFlight addCustomEnvironmentInformation:@"Anonymous" forKey:@"username"];
[TestFlight addCustomEnvironmentInformation:[PearlKeyChain deviceIdentifier] forKey:@"deviceIdentifier"]; [TestFlight addCustomEnvironmentInformation:[PearlKeyChain deviceIdentifier] forKey:@"deviceIdentifier"];
[TestFlight setOptions:[NSDictionary dictionaryWithObjectsAndKeys: [TestFlight setOptions:[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], @"logToConsole", [NSNumber numberWithBool:NO], @"logToConsole",
[NSNumber numberWithBool:NO], @"logToSTDERR", [NSNumber numberWithBool:NO], @"logToSTDERR",
nil]]; nil]];
[TestFlight takeOff:testFlightToken]; [TestFlight takeOff:testFlightToken];
[[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) { [[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) {
PearlLogLevel level = PearlLogLevelWarn; PearlLogLevel level = PearlLogLevelWarn;
@ -120,9 +123,9 @@
if ([localyticsKey length]) { if ([localyticsKey length]) {
inf(@"Initializing Localytics"); inf(@"Initializing Localytics");
[[LocalyticsSession sharedLocalyticsSession] LocalyticsSession:localyticsKey]; [[LocalyticsSession sharedLocalyticsSession] LocalyticsSession:localyticsKey];
[[LocalyticsSession sharedLocalyticsSession] open]; [[LocalyticsSession sharedLocalyticsSession] open];
[LocalyticsSession sharedLocalyticsSession].enableHTTPS = YES; [LocalyticsSession sharedLocalyticsSession].enableHTTPS = YES;
[[LocalyticsSession sharedLocalyticsSession] upload]; [[LocalyticsSession sharedLocalyticsSession] upload];
[[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) { [[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) {
if (message.level >= PearlLogLevelWarn) if (message.level >= PearlLogLevelWarn)
[[LocalyticsSession sharedLocalyticsSession] tagEvent:@"Problem" [[LocalyticsSession sharedLocalyticsSession] tagEvent:@"Problem"
@ -427,28 +430,19 @@
[TestFlight passCheckpoint:MPCheckpointConfig]; [TestFlight passCheckpoint:MPCheckpointConfig];
#endif #endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointConfig attributes: [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointConfig attributes:@{
@{ @"rememberLogin": [[MPConfig get].rememberLogin boolValue]? @"YES": @"NO",
@"rememberLogin": [[MPConfig get].rememberLogin boolValue] @"iCloud": [[MPConfig get].iCloud boolValue]? @"YES": @"NO",
? @"YES": @"NO", @"iCloudDecided": [[MPConfig get].iCloudDecided boolValue]? @"YES": @"NO",
@"iCloud": [[MPConfig get].iCloud boolValue]? @"YES" @"sendInfo": [[MPiOSConfig get].sendInfo boolValue]? @"YES": @"NO",
: @"NO", @"helpHidden": [[MPiOSConfig get].helpHidden boolValue]? @"YES": @"NO",
@"iCloudDecided": [[MPConfig get].iCloudDecided boolValue] @"showQuickStart": [[MPiOSConfig get].showQuickStart boolValue]? @"YES": @"NO",
? @"YES": @"NO", @"firstRun": [[PearlConfig get].firstRun boolValue]? @"YES": @"NO",
@"sendInfo": [[MPiOSConfig get].sendInfo boolValue] @"launchCount": NilToNSNull([[PearlConfig get].launchCount description]),
? @"YES": @"NO", @"askForReviews": [[PearlConfig get].askForReviews boolValue]? @"YES": @"NO",
@"helpHidden": [[MPiOSConfig get].helpHidden boolValue] @"reviewAfterLaunches": NilToNSNull([[PearlConfig get].reviewAfterLaunches description]),
? @"YES": @"NO", @"reviewedVersion": NilToNSNull([PearlConfig get].reviewedVersion)
@"showQuickStart": [[MPiOSConfig get].showQuickStart boolValue] }];
? @"YES": @"NO",
@"firstRun": [[PearlConfig get].firstRun boolValue]
? @"YES": @"NO",
@"launchCount": [[PearlConfig get].launchCount description],
@"askForReviews": [[PearlConfig get].askForReviews boolValue]
? @"YES": @"NO",
@"reviewAfterLaunches": [[PearlConfig get].reviewAfterLaunches description],
@"reviewedVersion": [PearlConfig get].reviewedVersion
}];
} }
} }
@ -521,12 +515,12 @@
[PearlInfoPlist get].CFBundleVersion) [PearlInfoPlist get].CFBundleVersion)
attachments:(logs attachments:(logs
? [[PearlEMailAttachment alloc] initWithContent:[[[PearlLogger get] formatMessagesWithLevel:logLevel] dataUsingEncoding:NSUTF8StringEncoding] ? [[PearlEMailAttachment alloc] initWithContent:[[[PearlLogger get] formatMessagesWithLevel:logLevel] dataUsingEncoding:NSUTF8StringEncoding]
mimeType:@"text/plain" mimeType:@"text/plain"
fileName:PearlString(@"%@-%@.log", fileName:PearlString(@"%@-%@.log",
[[NSDateFormatter rfc3339DateFormatter] stringFromDate:[NSDate date]], [[NSDateFormatter rfc3339DateFormatter] stringFromDate:[NSDate date]],
[PearlKeyChain deviceIdentifier])] [PearlKeyChain deviceIdentifier])]
: nil), nil] : nil), nil]
showComposerForVC:viewController]; showComposerForVC:viewController];
} }