No visible interface for dismissModalViewControlle

2019-07-18 07:23发布

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条回答
可以哭但决不认输i
2楼-- · 2019-07-18 07:52

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.

查看更多
登录 后发表回答