Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSMutableArray *_displayedErrors;
- void errorAlert(NSString *text) {
- if (!_displayedErrors) {
- _displayedErrors = [[NSMutableArray alloc] init];
- }
- if (text == nil) {
- text = @"Unknown error";
- }
- if ([_displayedErrors containsObject:text]) {
- return;
- }
- [_displayedErrors addObject:text];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [_displayedErrors removeObject:text];
- });
- UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error".localized message:text delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
- [alertView show];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement