简体   繁体   English

一元表达式的无效参数类型'void'

[英]invalid argument type 'void' to unary expression

I'm writing iOS app and I've got this error: 我正在编写iOS应用,但出现此错误:

Invalid argument type 'void' to unary expression 一元表达式的无效参数类型'void'

Here's the code: 这是代码:

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
  //code here
}

You got your method inside another method's body (maybe you've missed to type its closing } ?). 您将您的方法放入另一个方法的主体中(也许您错过了键入其结束}吗?)。 That's why you get the error. 这就是为什么您得到错误。 Try to move it outside somewhere in your .m file. 尝试将其移到.m文件中的某个位置之外。

Check the lines above your function. 检查功能上方的行。 Do you have unbalanced parantheses? 你有不平衡的寄生虫吗? Did you declare some incomplete statement? 您是否声明了一些不完整的陈述?

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

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