addObjectsFromArray

Posted by derek.lo on Stack Overflow See other posts from Stack Overflow or by derek.lo
Published on 2011-11-13T04:09:08Z Indexed on 2011/11/13 9:51 UTC
Read the original article Hit count: 292

Filed under:
|
|
|

I have a question about memory management when using the addObjectsFromArray method. Basically, I have 2 arrays defined in the appDelegate. I need these 2 arrays for the duration of my application's runtime. I therefore release them in my appDelegate's dealloc method.

When I go to use these two arrays in a class, I want one array to store the values from the other, so that the other can have it's contents removed, but still stick around for use.

Something like this:

[appDelegate.arrayTwo addObjectsFromArray:appDelegate.arrayOne];
[appDelegate.arrayOne removeAllObjects];

I'm getting the compiler error: EXC_BAD_ACCESS because of a pointer issue? retaining issue? Any help would be greatly appreciated!

Thanks

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c