views:

3233

answers:

5

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!

+1  A: 

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...

Mark Bessey
Why not simply use `NSClassFromString(@"UIPickerTable")`
JoostK
NSClassFromString is probably the right thing to use, but when I learned Objective-C, we didn't have those functions, so I tend not to think of them.
Mark Bessey
A: 

Using private APIs in an iPhone application is grounds for rejection from the AppStore (Google's proximity sensing feature not withstanding). Unless you plan to only use the software yourself, don't use private APIs. If there is no way to do what you want without resorting to private APIs, file a bug on Apple's radar.

Barry Wark
I'm basically just trying to put a label under the selectionIndicator of a UIPickerView to match the look of the CountDownTimer 'hours' 'mins' Would something as simple as that really be a problem ?
dizy
Since I'm not an Apple employee, I can't say for sure. All I know is what is written in the iPhone developer agreement: no private APIs. Sorry I can't be of more help. Like I said, I suggest you file a bug suggesting that this capability gets exposed.
Barry Wark
A: 

I may be totally missing the point here, but I came across something similar with AddressBook. I had included the AddressBook framework like so

#import <AddressBook/ABAddressBook.h>

But when I wanted to check on the class of the selected record in the peoplePickerView ..

NSArray *selected = [peoplePickerView selectedRecords];
for(id record in selected)
{
if([record isKindOfClass:[ABPerson class]])
{
    return [record valueForKey:@"identityUniqueId"];
}

}

...I got the warning that "receiver 'ABPerson' is a forward class and corresponding @interface may not exist". However, this proved easily fixed by adjusting the header file:

#import <AddressBook/ABAddressBook.h>
#import <AddressBook/ABPerson.h>
@class ABPerson;
Elise van Looij
A: 

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.

P120D1GY
+2  A: 

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

bubjavier