Skip to content

Commit

Permalink
* Fix a crasher that could happen after dismissing an error alert.
Browse files Browse the repository at this point in the history
* Remove delegation from the UIAlert used by NSError+LEPresenting.

## Analysis

It’s not a good idea to have instances of NSError serve as alert delegates, because they don’t stick around as long as the alert boxes do. It’s not necessary, either, as the method was just a stub.
  • Loading branch information
ElDragonRojo committed Aug 7, 2013
1 parent a2537c9 commit 6a8c5de
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Lemacs/Utilities/NSError+LEPresenting.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
//
// This convenient method simply presents an alert displaying the localized error.

@interface NSError (LEPresenting) <UIAlertViewDelegate>
@interface NSError (LEPresenting)
- (IBAction)present;
@end
10 changes: 1 addition & 9 deletions Lemacs/Utilities/NSError+LEPresenting.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@

@implementation NSError (LEPresenting)

#pragma mark - UIAlertViewDelegate

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
{

}


#pragma mark - API

- (IBAction)present;
Expand All @@ -41,7 +33,7 @@ - (IBAction)present;

NSString *localizedCancelButtonTitle = NSLocalizedString(@"OK", @"Generic error button title");

UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:localizedTitle message:localizedMessage delegate:self cancelButtonTitle:localizedCancelButtonTitle otherButtonTitles:nil];
UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:localizedTitle message:localizedMessage delegate:nil cancelButtonTitle:localizedCancelButtonTitle otherButtonTitles:nil];
[errorAlert show];
}

Expand Down

0 comments on commit 6a8c5de

Please sign in to comment.