Passing NULL value

Posted by FFXIII on Stack Overflow See other posts from Stack Overflow or by FFXIII
Published on 2010-06-14T16:47:38Z Indexed on 2010/06/14 18:12 UTC
Read the original article Hit count: 263

Hi. I use an instance of NSXMLParser. I store found chars in NSMutableStrings that are stored in an NSMutableDictionary and these Dicts are then added to an NSMutableArray.

When I test this everything seems normal: I count 1 array, x dictionnaries and x strings.

In a detailview controller file I want to show my parsed results. I call the class where everthing is stored but I get (null) returned.

This is what I do (wrong):

XMLParser.h

@interface XMLParser : NSObject {
    NSMutableArray *array;
    NSMUtableDictionary *dictionary;
    NSSMutabletring *element;
}
@property (nonatomic, retain) NSMutableArray *array;
@property (nonatomic, retain) NSMutableDictionary *dictionary;
@property (nonatomic, retain) NSMutableString *element;


XMLParser.m
@synthesize array, dictionary, element;
//parsing goes on here & works fine
//so 'element' is filled with content and stored in a dict in an array
//and released at the end of the file

In my controller file I do this:

controller.h
@class XMLParser;

@interface controller : UIViewController {
 XMLParser *aXMLParser;
}

@property (nonatomic, retain) XMLParser *aXMLParser;

controller.m
#import "XMLParser.h"

@synthesize aXMLParser;

- (void)viewDidLoad {
    NSLog(@"test array: %@", aXMLParser.array);
    NSLog(@"test dict: %@", aXMLParser.dictionary);
    NSLog(@"test element: %@", aXMLParser.element);
}

When I test the value of my array, a dict or an element in the XMLParser.h file I get my result. What am I doing wrong so I can't call my results in my controller file? Any help is welcome, because I'm pretty stuck right now :/

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about null