On 03-Jan-2010, at 1:10 PM, Yandy Ramirez wrote:

> the method [NSArray arrayWithObjects:] returns an autoreleased object,
> there's no need for you to release it yourself. According to ObjC memory
> management guidelines you only release when you. Retain and object,
> init/alloc and object or copy it. In this case I think your array is getting
> released before you have a chance to use it in your next method.. try this:
> 
> NSString* pa = [playerA stringValue];
> NSString* pb = [playerB stringValue];
> NSString* pc = [playerC stringValue];
> NSString* pd = [playerD stringValue];
> NSArray* pnl = [NSArray arrayWithObjects:pa,pb,pc,pd,nil];
> * [pnl retain]; // or use a NSArray *pnl = [[NSArray alloc]
> initWithObjects:] method.*
> [parentDocument setPlayerNameList:pnl];
> [pnl release];
> 
> 

no need to retain it, just don't release it (ie remove the [ pnl release ] 
call). _______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to