No visible interface for dismissModalViewControlle

2019-07-18 07:02发布

问题:

I have a UIViewController derived class which uses the method dismissModalViewControllerAnimated:(BOOL), like this:

[self dismissModalViewControllerAnimated:YES];

Since the compiler complains with a warning saying that this method is deprecated, I have changed it to the suggested replacement, dismissModalViewControllerAnimated:completion:, like this:

[self dismissModalViewControllerAnimated:YES completion:nil];

But now, a get an error in that line of code saying "No visible @interface for declares the selector dismissModalViewControllerAnimated:completion:

I can't see what's the problem, since both methods are defined in UIViewController.h, and my class derives from that class.

What am I doing wrong?

Thank you in advance

回答1:

It was my fault. The new method is

[self dismissViewControllerAnimated:YES completion:nil];

not

[self dismiss**Modal**ViewControllerAnimated:YES completion:nil];

Thank you all, and excuse me for my silly question.