Skip to content

Commit

Permalink
Send crash report once device is online instead of trying only once a…
Browse files Browse the repository at this point in the history
…t startup
  • Loading branch information
DerAndereAndi committed Nov 2, 2009
1 parent 7cacfba commit 10d67f8
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion iPhone/Classes/CrashReportSender.m
Expand Up @@ -185,11 +185,36 @@ - (void)scheduleCrashReportSubmissionToURL:(NSURL *)submissionURL delegate:(id)d
}
}

- (void)registerOnline
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(wentOnline:)
name:@"kNetworkReachabilityChangedNotification"
object:nil];
}

- (void)unregisterOnline
{
[[NSNotificationCenter defaultCenter] removeObserver:self
name:@"kNetworkReachabilityChangedNotification"
object:nil];
}

- (void)wentOnline:(NSNotification *)note
{
[self unregisterOnline];
[self attemptCrashReportSubmission];
}

- (void)attemptCrashReportSubmission
{
_submitTimer = nil;

if ([self hasPendingCrashReport] && [self _isSubmissionHostReachable]) {
if (![self _isSubmissionHostReachable]) {
[self registerOnline];
} else if ([self hasPendingCrashReport]) {
[self unregisterOnline];

if (![[NSUserDefaults standardUserDefaults] boolForKey:kAutomaticallySendCrashReports]) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"CrashDataFoundTitle", @"Title showing in the alert box when crash report data has been found")
message:NSLocalizedString(@"CrashDataFoundDescription", @"Description explaining that crash data has been found and ask the user if the data might be uplaoded to the developers server")
Expand Down

0 comments on commit 10d67f8

Please sign in to comment.