Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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'

The line in question was something like this:

int iResult = [MyUtils utilsMemberFunc:param1,param2];
like image 800
AlanKley Avatar asked Apr 01 '26 01:04

AlanKley


1 Answers

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.

So why isn't it finding the declaration? Because ',' is being used rather than ':' to separate the parameters.

like image 140
AlanKley Avatar answered Apr 02 '26 21:04

AlanKley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!