2010-02-26 66 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接口應該提及它符合該協議。