2010-02-26 38 views
-1

嘿,我一直在试图找出为什么我收到这样的警告:访问全球varibile任何类

“TxtAppDelegate”不能为“-TCN” “TxtAppDelegate”回应可能会不响应以“-TID”

,当我尝试使用此代码:

// .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文件头。代码有效,但我真的想解决警告问题。

任何帮助将是巨大的,解决矿山:)

大卫

回答

2

虽然看到TxtAppDelegate声明的头文件会更有帮助,但我猜测方法声明必须关闭。他们应该看起来像这样:

- (NSString *)TCN; 
- (NSString *)TID; 

如果这不是问题的原因,请在这里发布头文件,以便我们可以检查它。

+0

是的,谢谢。我忘了那个! :O) – StealthRT 2010-02-26 19:12:37

0

的这个问题如何被宣布在你的头这两个功能?

它们应该属于类别TxtAppDelegate或协议。如果你选择协议,TxtAppDelegate接口应该提及它符合该协议。