update! I have created a clean trial program that shows this issue.
Update 2! To understand more about this problem, see the comment thread of the Converted Code below.
Update: Added reward, what exactly is wrong with my example, what does it fix, and what design is better is the current "LoadNib_Controller" to suit my purpose (see concept code comment discussion)
I get a runtime error message "[ & lt; My_WindowLoader 0x100228ba0 & gt; valueForUndefinedKey:]: The key to this class Managed object is not coding-compatible for contact. "
My_WindowLoader contains references to My_AppDelegate (which Nne has been debugged and is definitely set up properly). It has some My_Window Controller * which is My_WindowController: NSWindowController is used so that I can provide a property (managed object contact) to Windows that loads when loaded, so that I can set my core data binding . They look like this ..
.h: @interface My_WindowController: NSWindowController {NSManagedObjectContext * managedObjectContext; } @property (non-standard, intact) nsmanned object contact * managed object contact; .m @ infected managed object contexts; The My_WindowLoader loads a nib in the following manner:
Window 1_windows controller = [[My_ WindowController alloc] initWithWindowNibName: @ "Window1" owner : Self]; // I have been debugged in the following line and it actually goes to my app representative, in which it gives the lines of an MOC (since it is the first place in the code that has been used for it), and It takes it back, and it also appears to be set in the My_WindowController property by means of [Window 1_Windows Controller SettingsManage Object Context: [AppDelegate managedObjectContext]]; // The following problem is where I have my problem, it loads my window, but in my GDB window I see the runtime error message that is listed at the top of this post. NSWindow * window1Pointer = [Window1_WindowController window]; To get the runtime error above, in my window 1. NIB I have array controllers who bond their modeled object context with the "file owner" with the path of the model "Managed ObacContacts". The type of owner of the file is My_WindowController
Obviously, something is wrong, but I have used common sense along with the debugger through it, and it seems like this should work. I am seeing the most "This class is not KVC." There are errors in defaming things in IBolet / IB etc., but I have examined all three here and I have ensured that I completely quit and restarted Xcode / IB and loaded the latest.
Thanks for #cok on the Freenode, my problem is that I am doing:
Window 1_windows controller = [[[My_ WindowController alloc] initWithWindowNibName: @ "Window1" owner: Self]; I should
window 1_windows controller = [[My_ WindowController alloc] initWithWindowNibName: @ "Window1"]; InitWithWindowNibName: vs initWithWindowNibName: Owner: In addition to this, the right place to put this code is in AppDelegate, this is the app controller and thus the logic is at home.
Comments
Post a Comment