ios - Objective C assigning a value to a variable -
i have line in header file
@property (strong, nonatomic) nsmutabledictionary *weatherdata;
and i'm truing following on implementation
-(void)dosomething { nsmutabledictionary *data = [[nsmutabledictionary alloc] init]; //after adding items data self.weatherdata = data; }
then have function
-(nsmutabledictionary *)getweaterdata { nslog([self.weatherdata description]); return self.weatherdata; }
why noting gets printed, above data has data in it.
edit
self.weather data getting populated asynchronous method. take while. when i'm using nslog, wasn't populated yet. that's why nothing getting printed :d
all fixed adding delegate call back
i not believe problem rests code you've shared far. might want try adding "watch" of variable backing class property (basically, tell debugger stop execution every time code tries update value property).
if want this, can:
add breakpoint in code before set property first time;
run app in debugger stops @ breakpoint;
add watch on variable control clicking on variable in "variables view" in "debug area" in xcode (in case, i'd adding watch on
objects
property):continue execution of program hitting "continue" button ().
the app stop app every time property changes, can inspect line of code changing value , examine other associated variables. if debugger stops @ cryptic assembler code, click on "step out" button () until see of own code recognize.
perhaps "watching" can identify setting and/or resetting value of weatherdata
in app.
Comments
Post a Comment