Skip to content

Instantly share code, notes, and snippets.

@advantis
Created April 22, 2012 09:41
Show Gist options
  • Save advantis/2463098 to your computer and use it in GitHub Desktop.
Save advantis/2463098 to your computer and use it in GitHub Desktop.
Shortcut method for quick NSError presentation
//
// Copyright © 2010 Yuri Kotov
//
#import <Foundation/Foundation.h>
@interface NSError (ADVAlertPresentation)
- (void) displayInAlert;
@end
//
// Copyright © 2010 Yuri Kotov
//
#import "NSError+ADVAlertPresentation.h"
#import <UIKit/UIKit.h>
@implementation NSError (ADVAlertPresentation)
- (void) displayInAlert
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil)
message:[self localizedDescription]
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[alert show];
#if !__has_feature(objc_arc)
[alert release];
#endif
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment