• 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
mutableCopy question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mutableCopy question


  • Subject: mutableCopy question
  • From: Peter Schols <email@hidden>
  • Date: Fri, 11 Jun 2004 15:28:28 +0200

Hi,

I'd like to be able to duplicate my model objects (class Backup, subclass of NSObject).
I've tried to implement this as follows (see below), but it consistently crashes after duplication.
Any help would be appreciated.

Thanks in advance,


Peter


____________________________________________

In Backup.m:

- (id)mutableCopyWithZone:(NSZone *)zone
{
return(NSCopyObject(self, 0, zone));
}


In my controller class:

- (IBAction)duplicateBackup:(id)sender;
{
int i;
for (i = 0; i < [[backupsController selectedObjects] count]; i++) {
Backup *newBackup = [[[backupsController selectedObjects] objectAtIndex:i]mutableCopy];
[newBackup setName:[[newBackup name] stringByAppendingString:@" Copy"]];
[self insertObject:newBackup inBackupsAtIndex:[self countOfBackups]];
[newBackup release];
}
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: mutableCopy question
      • From: Clark Cox <email@hidden>
    • Re: mutableCopy question
      • From: j o a r <email@hidden>
  • Prev by Date: POST request without NSURLConnection
  • Next by Date: Re: POST request without NSURLConnection
  • Previous by thread: Re: POST request without NSURLConnection
  • Next by thread: Re: mutableCopy question
  • Index(es):
    • Date
    • Thread