0

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.

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.