Oddness with automatic CoreData sheet-errors when used from a bundle
Oddness with automatic CoreData sheet-errors when used from a bundle
- Subject: Oddness with automatic CoreData sheet-errors when used from a bundle
- From: Neil Clayton <email@hidden>
- Date: Fri, 22 Jun 2007 16:58:02 +1200
I'm trying to track down some difference in behavior that I see
between two applications. The two apps are:
The environment:
1) A basic new CoreData application, with one object. The controls
are option-dragged onto the form. It's all 100% standard xcode
template stuff.
2) My own app, where everything apart from the main (empty) window is
loaded from a separate bundle. I'll call this other bundle the
'external' bundle - just to be clear.
Constraints are placed in the model. For example: An integer
field myNumber may have a minimum of 1 and maximum of 60.
There are numeric formatters applied to the text fields. These use
the standard "100" type format (it's an option in IB). Nothing else
is changed on the formatter (there is no minimum/maximum on the
formatter itself).
The problem:
When an automatic validation error occurs, for example when I enter
"a" into the numeric field, (1) shows a nice dialog with "Invalid
number" and gives the option to "Discard Changes" or "OK" (which just
does nothing and lets you go fix the error. This is expected.
App (2) shows an error "Error", with just an OK button.
What I've observed (by experimentation) is that if I compile the
application delegate directly into the app (that is, I don't load it
as part of the bundle) then it works. The error is displayed correctly.
Is there something I must do in CoreData such that errors will show
correctly when loading the application delegate from a bundle?
It's worth pointing out that the main UI's contentView is also loaded
from the same bundle. The main UI window itself is part of the
applications nib file (so is NOT loaded from the external bundle).
When the app bootstraps it loads the external bundle, finds the main
content view, and replaces that in the main window. It then also
sets [NSApp setDelegate:aDelegate]; using an instance of the class in
the external bundle.
It's almost as though the "validation error" code is firing; looking
up some localized resources (such as error strings, and perhaps
options for the dialog) - and failing to find them because it's
perhaps assuming them to exist in [NSBundle mainBundle] and then just
bailing out with a default "error" dialog with one button.
Anyone got any tips or advice?
--
Regards,
Neil Clayton
http://shinywhitebox.com
_______________________________________________
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