简体   繁体   English

为什么会看到以下警告:“假定没有匹配方法签名的消息将返回'id'并接受'...'作为参数”?

[英]Why am I seeing the following warning: “Messages without a matching method signature wii be assumed to return 'id' and accept'…'as arguments ”?

while wirting below code i have got the warning:"Messages without a maching method signature wii be assumed to return 'id' and accept'...'as arguments" 在下面的代码中输入消息时,我得到了警告:“假定未使用任何方法签名的消息将返回'id'并接受'...'作为参数”

ViewSlider *viewSlider=[[ViewSlider alloc]init];
[viewSlider slideView:view1 secondView:view2]; 

Probably because the method related to 可能是因为该方法与

[viewSlider slideView:view1 secondView:view2];

does not appear in the header file of your ViewSlider. 不会出现在ViewSlider的头文件中。

Like unforgiven said, you probably want to declare it in the header file. 就像不可原谅的所说,您可能想在头文件中声明它。 This way, the compiler knows about the message when you're using it. 这样,编译器会在您使用消息时知道该消息。

In Objective-C you can still send the message though, even if it's uknown to the compiler. 即使在编译器不知道的情况下,在Objective-C中您仍然可以发送消息。 But if the compiler doesn't know about it, it'll have to make some assumptions. 但是,如果编译器对此一无所知,则必须做出一些假设。 Like the return type and the type of its arguments. 类似于返回类型及其参数的类型。 That's what the warning is for: "Hey, look, you can send that slideView:secondView: message I never heard of but then I'm just going to assume it will return some object and accepts anything as it's parameters." 那就是警告的意思:“嘿,看,您可以发送我从未听说过的slideView:secondView:消息,但是我只是假设它会返回某个对象并接受任何内容作为其参数。”

Have you imported the Files in the .m file...??? 您是否已将文件导入.m文件...? If not, declare the files of view1 & view2 in .m file. 如果不是,请在.m文件中声明view1和view2的文件。 That might help. 这可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM