THANK YOU!

On May 20, 2008, at 9:33 AM, Michael Babin wrote:

On May 19, 2008, at 11:41 PM, Daniel Child wrote:

After reading a host of theoretical explanations on bindings, I tried the bindings-based currency converter tutorial to try to get some basic feel for bindings in practice. The example is written for an earlier version of OSX, but I think I reproduced it correctly for XCode 3. However, I get the following runtime error.

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot create number from object <_NSControllerObjectProxy: 0x148070> of class _NSControllerObjectProxy'

I am surprised by the error because bindings is supposed to be "smart enough" to convert the numbers in text fields (strings) to numbers when necessary. For those who haven't seen the tutorial, the interface is:

@interface Converter : NSObject
{
double dollarsToConvert;
double exchangeRate;
}
-(double) amountInOtherCurrency;
// implemented as return (double) (dollarsToConvert * exchangeRate)
@end

I have no idea what this error means and found no helpful references on the web. If someone could shed some light on this issue I'd really appreciate it. Thanks.

You probably don't have the Model Key Path of the Value binding for one of your text fields set correctly. Without it, you're binding the text field's value to the object controller's selection (your Converter object), instead of one of Converter's keys (exchangeRate, dollarsToConvert, amountInOtherCurrency). The error is complaining that it doesn't know how to create a number from your Converter object. The NSControllerObjectProxy is a proxy object (see NSProxy) returned by the object controller to represent the actual object (Converter) which you set as the object controller's content.


_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to