views:

17

answers:

1

I create an NSMutableArray:

SBJsonParser *parser = [[SBJsonParser alloc] init];
NSMutableArray *components = [parser objectWithString:@"[\"Item1\",\"Item2\"]"];

then I access it from the same method: no problem! Then I try to access it from another object: crash!!?? It doesn't happen if i create the NSMutableArray with other means (e.g. initWithObjects:)

Any clue? It's been all day I can't find a solution to this.

+2  A: 

The array returned from [parser objectWithString:] is autoreleased; you need to retain it yourself if you want to keep it around.

(You're also probably leaking parser unless you're releasing it later in your method.)

Wevah
gee thanks i thought the retain was automatical!
gurghet