3

Can anyone tell me why this code crashes with SIGABRT unrecognised selector sent to instance, on 4.3 simulator, but works just fine on iOS 5 simulator?

matchSetup = [[viewMatchSetup alloc]initWithNibName:@"viewMatchSetup" bundle:nil];
[matchSetup setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:matchSetup animated:YES completion:NULL];

Thanks in advance

FIX: [self presentModalViewController:matchSetup animated:YES]; //Modal being the required change

Dann
  • 323
  • 5
  • 17

1 Answers1

12

It crashes because the presentViewController:animated:completion: method of UIViewController is not available on iOS 4.3. It was introduced in iOS 5. Since you don't use the completion block, simply use the "old" method presentModalViewController:animated::

[self presentModalViewController:matchSetup animated:YES];
DarkDust
  • 90,870
  • 19
  • 190
  • 224