2

I have the following code:

NSLog(@"items: %d", [items count]);
NSLog(@"allObjects: %d", [self.allObjects count]);

[self.allObjects addObjectsFromArray:items];

NSLog(@"allObjects: %d", [self.allObjects count]);

Which produces the following output:

items: 7
allObjects: 0
allObjects: 0

items is a NSArray

allObjects is a NSMutableArray.

I'm confused as to why the objects in items are not being added to allObjects. I expect it's something simple, but there is a hole in my understanding here.

1
  • can you post the code where you instantiate allObjects? Commented Mar 23, 2010 at 14:54

1 Answer 1

5

Let me guess. self.allObjects is nil. Sending messages to nil is a no-op.

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

1 Comment

facepalm Might have to call it a day. Ugh.

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.