Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Receiver 'ClassName' is a forward class and corresponding @interface may not exist

Im currently trying to find a UIPickerTable within the UIPickerView.subviews ... so i loop through and do isKindOfClass:[UIPickerTable class] .... which works.. but because the header of UIPickerTable isn't exposed i get a warning that "receiver 'UIPickerTable' is a forward class and corresponding @interface may not exist'

In order to even be able to compile I do @class UIPickerTable, and obviously it want's me to #include it.

I'm wondering if there's a way to get around seeing this warning.

TIA!

like image 627
dizy Avatar asked Mar 06 '09 22:03

dizy


3 Answers

Maybe you have @class UIPickerTable in your .h file and you did not have #import UIPickerTable.h on your {RootViewController}.m file

like image 146
bubjavier Avatar answered Nov 17 '22 19:11

bubjavier


I don't think that you can suppress that warning with a compiler option. You could make it go away by simply creating your own header file for the class, containing:

@interface FacesViewController : NSObject {
}

I suppose it goes without saying that having your application depend on the internal structure of a UIKit class is probably not the best strategy. Presumably you have a good reason for mucking about inside the UIPicker...

like image 5
Mark Bessey Avatar answered Nov 17 '22 21:11

Mark Bessey


Importing the class vs using the @class directive will solve this warning. Remember, @class doesn't tell the compiler what "signature" methods/classes have, instead it just says that the class exists so don't error out. When going into detail, use import "..." instead so it includes the header / interface for the class.

like image 1
Imran Avatar answered Nov 17 '22 21:11

Imran