• 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
Re: Binding Tableviews (newbie) problems/questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding Tableviews (newbie) problems/questions


  • Subject: Re: Binding Tableviews (newbie) problems/questions
  • From: mmalcolm crawford <email@hidden>
  • Date: Thu, 13 Jan 2005 21:37:09 -0800


On Jan 13, 2005, at 9:02 PM, Vince Ackerman wrote:

I'm not intimately familiar with Scott's example, so apologies in advance if this leads astray, but:

- (IBAction) addEmail: (id)sender
{
    // get current mailbox

    int mailboxRow = [mailboxTable selectedRow];
    if (mailboxRow < 0) return;
    Mailbox * mailbox = [[self mailboxes] objectAtIndex: mailboxRow];

    // get mutable array of emails
    // and add new instance

    NSMutableArray * emails = [mailbox emails];
    Email * newEmail = [[Email alloc] init];

[[self mutableArrayValueForKey: @"emails"] addObject: newEmail]; // <------ added/replaced

I believe 'emails' a property of Mailbox?
The following would seem more appropriate:

    [[mailbox mutableArrayValueForKey: @"emails"] addObject: newEmail];

That would account for the error log:

[Session started at 2005-01-13 20:44:55 -0800.]
2005-01-13 20:45:06.086 MailDemo[3357] [<MyController 0x33a460> valueForUndefinedKey:]: this class is not key value coding-compliant for the key emails.



Note that it also seems that you're leaking the new email.

mmalc

_______________________________________________
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


References: 
 >Re: Binding Tableviews (newbie) problems/questions (From: Vince Ackerman <email@hidden>)

  • Prev by Date: Deleting Java docs (was Re: Obj-C NSRect methods help)
  • Next by Date: Re: Binding Tableviews (newbie) problems/questions
  • Previous by thread: Re: Binding Tableviews (newbie) problems/questions
  • Next by thread: Re: Binding Tableviews (newbie) problems/questions
  • Index(es):
    • Date
    • Thread