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:

  1. add breakpoint in code before set property first time;

  2. run app in debugger stops @ breakpoint;

  3. 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):

    enter image description here

  4. continue execution of program hitting "continue" button (continue)).

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 (step out) until see of own code recognize.

perhaps "watching" can identify setting and/or resetting value of weatherdata in app.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -