I'm new to Objective C and I'm having a problem reading NSMutableDisctionary from another class. NSMutableDictionary itself is working fine in ViewController class, but when I try to read it in TestResults class i get empty dictionary. Where did I go wrong? Thanks!
ViewController.h
@property NSMutableDictionary *storedAnswers;
ViewController.m
@implementation ViewController
@synthesize questionScrollView;
- (id)init
{
self = [super init];
if (self) {
[_storedAnswers setObject:@"aaa" forKey:@"bbb"];
}
return self;
}
TestResults.h
#import "ViewController.h"
ViewController *answers = [[ViewController alloc] init];
NSLog(@"%@",answers.storedAnswers);