• 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: "remote" binding problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "remote" binding problem


  • Subject: Re: "remote" binding problem
  • From: David Hirsch <email@hidden>
  • Date: Tue, 06 Oct 2009 20:12:15 -0700


On Oct 6, 2009, at 7:56 PM, Graham Cox wrote:

In Interface Builder, I would like to bind a text field to the current score. When I set up the text field value's binding to File's Owner.quizResults.currentScore, the app crashes inside loadNib (inside NSPopAutoreleasePool). Is that expected behavior? Do I need to set up the binding programatically? Can I use an NSObjectController to get around this, as some web search results have implied (but I cannot make work)?

There probably isn't enough here to give a definite answer.

My guess is that the class QuizResults is unknown at compile time, and thus the 'currentScore' property isn't being accessed correctly. Does your code emit any warnings when it is compiled? If so, fix them.

I get no problems at compile time

ModeQuizDoc needs at minimum a forward declaration for QuizResults, and the .m file should include QuizResults.h.

This is indeed the case.

More importantly, the QuizResults class and its currentScore property needs to be visible to anyone interested in it including IB.

It is: IB knows the contents of the .h files, right? It knows that currentScore is a float, because when I bind to it, the placeholder fields in the Bindings inspector all say "<number value>"


I would strongly recommend a property accessor for it instead of relying on accessing the ivar directly.

But I can't bind through an accessor, can I? I'm supposed to be able to bind to the ivar, I think.


If any code is assuming this property is type id instead of float, you'll probably get the crash that you seem to be getting.
--Graham





-Dave


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: "remote" binding problem
      • From: Graham Cox <email@hidden>
References: 
 >"remote" binding problem (From: David Hirsch <email@hidden>)
 >Re: "remote" binding problem (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: "remote" binding problem
  • Next by Date: Re: Suggest reasons for this crash?
  • Previous by thread: Re: "remote" binding problem
  • Next by thread: Re: "remote" binding problem
  • Index(es):
    • Date
    • Thread