Hey all i have been trying to figure out why i am getting this warning:
'TxtAppDelegate' may not respond to '-TCN' 'TxtAp开发者_如何学CpDelegate' may not respond to '-TID'
when i try to use this code:
// .h file
@interface RootViewController : UITableViewController <UIActionSheetDelegate> {
NSString *theCompanyName;
NSString *theID;
}
@property (nonatomic, retain)NSString *theCompanyName;
@property (nonatomic, retain)NSString *theID;
// .m
NSString *theCompanyName;
NSString *theID;
@synthesize theCompanyName;
@synthesize theID;
TxtAppDelegate *customObjInstance = [[TxtAppDelegate alloc] init];
theCompanyName = [customObjInstance TCN];
theID = [customObjInstance TID];
I've added the header for the .h file that has the two functions in them. The code works but i really would like to solve the warning problem.
Any help would be great to solve this problem of mine :)
David
While it would have been more helpful to see the header file where TxtAppDelegate is declared, I'm guessing the method declarations must be off. They should look like this:
- (NSString *)TCN;
- (NSString *)TID;
If this is not the cause of the problem, please post the header file here so we can examine it.
How are declared these two functions in your header?
They should belong to a category of TxtAppDelegate
class or to a protocol. If you choose the protocol, TxtAppDelegate
interface should mention that it conforms to that protocol.
精彩评论