开发者

'MyViewController' may not respond to '-showEmailModalView'

I have the following code written in MyViewController.m as part of a series of methods used to open up an in-app email utility when a UIAlertView is dismissed with the alert's Confirm button (the user does something, the alert view appears asking for confirmation, the user clicks confirm). I found this implementation of in-app email here.

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
    if (buttonIndex == 1) {
        [self showEmailModa开发者_如何学PythonlView];
    }
}

This code actually works exactly as intended without any apparent problems; however, there is a Compiler Warning on the third line:

[self showEmailModalView];

The Warning reads: "'MyViewController' may not respond to'-showEmailModalView'"

What I want to know is, does anyone know why this Warning occurs here or what the correct way to call this method is?


You haven't declared the -showEmailModalView method in your interface, and it probably isn't defined in the implementation until after the point where you use it. The compiler is saying "I don't know what this method you're calling is... nobody has mentioned it yet." You can get rid of the warning by simply declaring the method in your interface.


you should add

- (void)showEmailModalView;

to the MyViewController.h header file so the compiler knows that your object responds to this message.


Do you have

- (void)showEmailModalView;

declared in MyViewController.h?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜