objective c - Store global local time variables in the database in iphone -
i have been trying store global variables in form of nsdate seems gives error. trying grab current date @ start of application , store date once application finished in database. reason download current date: downloading data may take time , lose seconds in between.
in appdelegate.h
nsdate *today; @property (nonatomic, retain) nsdate *today; in appdelegate.m
today = [nsdate date]; when view date today in view controller, stops functioning.
in viewcontroller.m
appdelegate *appdelegate= [[uiapplication sharedapplication] delegate]; [appdelegate today]; // error here what correct way in retrieving date variable delegate method?
in code example looks redefining today. should not assigned today directly either way, need set property this.
self.today = [nsdate date]; the reason because [nsdate date] autoreleased object , when use property retain you.
Comments
Post a Comment