Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: Trying to call method implemented in category

The prequel for this question is here.

I have a class (A) and the class has category. In the category I've defined and implemented a method.

Now I am trying in (let's assume B) class to call [a someMethod]. My B class can't reach this method. Isn't possible to call the category meths from some other class?

like image 238
NCFUSN Avatar asked Jan 29 '26 15:01

NCFUSN


2 Answers

You didn't show your code, but in the .m file that refers to the category method, you do need to import the header of the file that defines the category interface.

like image 94
Jim Avatar answered Feb 01 '26 06:02

Jim


If you define a category in a .m file, you will not be able to call the category's methods from outside of that .m file.

like image 22
Mark Avatar answered Feb 01 '26 05:02

Mark



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!