use*_*648 1 cocoa-touch protocols objective-c ios
最初我在LoginViewController.m中有包含下面警告的文件,我忽略了它.代码工作正常.
warning: sending 'LoginViewController *' to parameter of incompatible type 'id<NSStreamDelegate>'
Run Code Online (Sandbox Code Playgroud)
但现在我将文件扩展名更改为.mm(LoginViewController.mm).现在我无法再构建项目了,因为这个错误.
Cannot initialize a parameter of type 'id<NSStreamDelegate>' with an lvalue of type 'LoginViewController *'
Run Code Online (Sandbox Code Playgroud)
怎么了?
warning: sending 'LoginViewController *' to parameter of incompatible type 'id<NSStreamDelegate>'
Run Code Online (Sandbox Code Playgroud)
此警告是由于NSStreamDelegate您在定义类时不符合协议LoginViewController.理想情况下,您的类应该符合该协议,以便在将其设置为委托时,它可以理解您正在实现它期望的任何委托方法.
例如: -
@interface LoginViewController : UIViewController<NSStreamDelegate> {}
Run Code Online (Sandbox Code Playgroud)
修复此问题后,您不应该遇到更改为.mm类时出现的其他错误.
| 归档时间: |
|
| 查看次数: |
914 次 |
| 最近记录: |