[英]Why am I getting this Objective-C error message: invalid conversion from 'objc_object*'
This error message had me stumped for a while: 这个错误消息让我感到困惑了一段时间:
invalid conversion from 'objc_object* to 'int' 从'objc_object *到'int'的无效转换
The line in question was something like this: 有问题的一行是这样的:
int iResult = [MyUtils utilsMemberFunc:param1,param2];
It doesn't matter what the "to" type is, what is important is that you recognize that this message, in this context, is reporting that the utilsMemberFunc declaration was not found and due to Objective-C's dynamic binding it is assuming it returns an objc_object* rather than the type that utilsMemberFunc was declared to return. “to”类型是什么并不重要,重要的是您认识到此消息在此上下文中报告未找到utilsMemberFunc声明,并且由于Objective-C的动态绑定,它假设它返回objc_object *而不是声明utilsMemberFunc返回的类型。
So why isn't it finding the declaration? 那为什么不找到声明呢? Because ',' is being used rather than ':' to separate the parameters. 因为','而不是':'来分隔参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.