-4

I know that this question has already been asked, but how do it fix the problem referring to this line.

 -(void) achievementViewControllerDidFinish:(GKAchievementViewController *)viewController
{
    AppController *app = (AppController*) [[UIApplication sharedApplication] delegate];
    [[app navController] dismissModalViewControllerAnimated:YES];
}

referring to [[app navController] dismissModalViewControllerAnimated:YES]; 'dismissModalViewControllerAnimated:' is deprecated in iOS 6.0.

P.J.Radadiya
  • 1,493
  • 1
  • 12
  • 21
Abby
  • 1
  • 2

2 Answers2

2

If you press ALT while clicking on the method in XCode, you can see more information about the method, including the availability. In the Availability section, it will suggest what method to use if the current method is deprecated. For the dismissModalViewControllerAnimated:, the suggestion is to use dismissViewControllerAnimated:completion:. So you can replace it with the latter with completion param as nil.

enter image description here

Valent Richie
  • 5,226
  • 1
  • 20
  • 21
  • Funny. In the year 2017, Xcode 8 does not show any alternatives or best-practices... – ecth Nov 13 '17 at 13:04
0

For iOS 5.0+ is

- (void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion

you can pass Nil in "completion"

Vertig0
  • 623
  • 3
  • 15