Reputation: 616
My App crashed because I set time from one ViewController to one ViewController in AppDelegate.m for method below and it show the message : unrecognized selector sent to instance 0x6a0e360.
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self performSelector:@selector(toSecondViewController:) withObject:nil afterDelay:5];
}
-(void)toSecondViewController{
SecondViewController *second = [[SecondViewController alloc] init];
[self.navigationController pushViewController:sale animated:YES];
}
I don't know why ?
Upvotes: 0
Views: 83
Reputation: 720
If you want to send any parameter then only you should add ":". Otherwise there is no need to add.
So the correct code is- [self performSelector:@selector(toSecondViewController) withObject:nil afterDelay:5];
Upvotes: 1
Reputation: 2585
try change code
[self performSelector:@selector(toSecondViewController:) withObject:nil afterDelay:5];
to
[self performSelector:@selector(toSecondViewController) withObject:nil afterDelay:5];
If func is not have any parameter, then don't add ":" symbol after func name
Upvotes: 2