• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSMutableCopy Issue - New to Cocoa and Objective-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSMutableCopy Issue - New to Cocoa and Objective-C


  • Subject: NSMutableCopy Issue - New to Cocoa and Objective-C
  • From: Andrew Filipowski <email@hidden>
  • Date: Tue, 26 Jul 2005 06:39:23 -0500

I am having a little bit of an issue figuring out why I can't make a mutable copy of one of my objects. I learn allot better by doing than reading so I bought a couple of books on Objective-C and Cocoa and have started writing an app that I have wanted to have for years. Here is the basics. I have an array of leagues, these leagues have weeks and each week has an array of players. From week to week the players may or may not be the same (for the most part they are with the subtraction and addition of a new member). When the user clicks on the add new week button, I add a week and want to copy the players to the new week. I originally just copied the array that they were in thinking that it was a deep copy I was wrong. So I created a new method in my weeks object that creates iterates through an array it is passed (the previous weeks array) and copies the player objects in side. Here is the code for that method:

-(void)createPlayersFromPreviousWeek:(NSMutableArray *)aPlayersArray
{
players = [[NSMutableArray alloc] init];
int n;
for (n = 0; n < [aPlayersArray count]; n++)
{
[players insertObject:[[aPlayersArray objectAtIndex:n] mutableCopy] atIndex:n];
}
}


I have added the following to my Player.h file as well:

@interface Player : NSObject <NSCoding, NSCopying, NSMutableCopying>

This is the error that I receive when I run my app:

*** NSRunLoop ignoring exception '*** -[Player copyWithZone:]: selector not recognized [self = 0x3c4910]' that raised during posting of delayed perform with target 3d5fe0 and selector 'invokeWithTarget:'


Any help would be much appreciated there is one other thing that is giving me problems right now but I am trying to tackle one issue at a time.


Andrew
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSMutableCopy Issue - New to Cocoa and Objective-C
      • From: Andreas Mayer <email@hidden>
    • Re: NSMutableCopy Issue - New to Cocoa and Objective-C
      • From: Andrew Filipowski <email@hidden>
  • Prev by Date: Custom line breaking in NSTextView
  • Next by Date: other question ...
  • Previous by thread: Re: Custom line breaking in NSTextView
  • Next by thread: Re: NSMutableCopy Issue - New to Cocoa and Objective-C
  • Index(es):
    • Date
    • Thread