Skip to content

Instantly share code, notes, and snippets.

@taterbase
Created March 20, 2012 02:15
Show Gist options
  • Save taterbase/2130165 to your computer and use it in GitHub Desktop.
Save taterbase/2130165 to your computer and use it in GitHub Desktop.
Crashing function for Objective-C
-(void)crash {
NSArray *arr = [[NSArray alloc] initWithObjects:@"Crash LOL", nil];
[arr objectAtIndex:3];
}
- (void)viewDidLoad
{
int time = arc4random() % 20;
[NSTimer scheduledTimerWithTimeInterval:time target:self selector:@selector(crash) userInfo:nil repeats:NO];
}
@atticus88
Copy link

You could take out the whole -(void)crash function and you will get the a crash as well. It gives a unrecognized selector error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment