Iphone 在任何类中访问全局变量
嘿,我一直在想为什么我会收到这样的警告: “TxtAppDelegate”可能不响应“-TCN” “TxtAppDelegate”可能不响应“-TID” 当我尝试使用此代码时:Iphone 在任何类中访问全局变量,iphone,objective-c,xcode,Iphone,Objective C,Xcode,嘿,我一直在想为什么我会收到这样的警告: “TxtAppDelegate”可能不响应“-TCN” “TxtAppDelegate”可能不响应“-TID” 当我尝试使用此代码时: // .h file @interface RootViewController : UITableViewController <UIActionSheetDelegate> { NSString *theCompanyName; NSString *theID; } @property (nonatom
// .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];
我已经为包含两个函数的.h文件添加了头。代码可以工作,但我真的想解决警告问题
任何帮助都会很好地解决我的这个问题:
David如何在标题中声明这两个函数
它们应该属于TxtAppDelegate类或协议的一个类别。如果选择协议,TxtAppDelegate接口应该说明它符合该协议。虽然查看声明TxtAppDelegate的头文件会更有帮助,但我猜方法声明必须关闭。它们应该是这样的:
- (NSString *)TCN;
- (NSString *)TID;
如果这不是问题的原因,请在这里发布头文件,以便我们可以检查它