我有一個奇怪的艾利我issue.Let第一代碼發佈到您不能訪問我的應用程序代理的屬性和方法在另一個類的iOS 4.3
在我appdelegate.h
#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>
#import "SecondViewController.h"
@class MasterViewController;
@class DetailViewController1;
@interface TestAppDelegate : NSObject <UIApplicationDelegate> {
NSTimer *tempTimer;
}
@property(nonatomic, retain) NSTimer *tempTimer;
-(void)test;
@end
In my app delegate .m
@synthesize tempTimer
在我SecondViewController.h
@class TestAppDelegate;
@interface SecondViewController : UIViewController
{
TestAppDelegate *appDel;
NSTimer *aTimer;
}
@property (nonatomic, retain) NSTimer *aTimer;
@end
在我SecondViewCo ntroller.m
@synthesize aTimer, appDel;
在viewDidload
方法
appDel =(TestAppDelegate *)[[UIApplication sharedApplication] delegate];
self.aTimer = appDel.tempTimer;
現在我得到以下錯誤
*屬性 「tempTimer」 不是類型的對象中找到 「TestAppDelegate 」
「testTimer」是錯誤中的拼寫錯誤嗎?它似乎是「tempTimer」。 – Bemmu 2011-05-10 10:54:46
對不起,我的錯誤,看看我編輯了這個問題。它tempTimer無處不在 – Swastik 2011-05-10 10:57:51