Re: Are instances of a NSManagedObject subclass usable as regular objects?
Re: Are instances of a NSManagedObject subclass usable as regular objects?
- Subject: Re: Are instances of a NSManagedObject subclass usable as regular objects?
- From: Daryle Walker <email@hidden>
- Date: Tue, 14 Feb 2017 18:50:59 -0500
Looking at my code again, I had a massive brain-fart. I created all the data objects with local “let,” but forgot to assign the top-level object to my document’s data property.
Once I did that, the window doesn’t show up at all due to a different problem:
> 2017-02-14 18:43:00.018210 XNW[13100:1621112] Cannot create NSArray from object Relationship 'header' on managed object (0x608000085460) <InternetMessages.RawMessage: 0x608000085460> (entity: Message; id: 0x600000031300 <x-coredata://B63E5B93-8B0A-49C1-BC6A-D4C948A2CA61/Message/p2> ; data: {
> body = "Is this an accurate test?";
> header = (
> "0x6000000312a0 <x-coredata://B63E5B93-8B0A-49C1-BC6A-D4C948A2CA61/HeaderField/p3>",
> "0x600000031140 <x-coredata://B63E5B93-8B0A-49C1-BC6A-D4C948A2CA61/HeaderField/p1>"
> );
> }) with objects {(
> <InternetMessages.RawHeaderField: 0x608000083390> (entity: HeaderField; id: 0x6000000312a0 <x-coredata://B63E5B93-8B0A-49C1-BC6A-D4C948A2CA61/HeaderField/p3> ; data: {
> body = World;
> message = "0x600000031300 <x-coredata://B63E5B93-8B0A-49C1-BC6A-D4C948A2CA61/Message/p2>";
> name = Hi;
> }),
> <InternetMessages.RawHeaderField: 0x608000083750> (entity: HeaderField; id: 0x600000031140 <x-coredata://B63E5B93-8B0A-49C1-BC6A-D4C948A2CA61/HeaderField/p1> ; data: {
> body = planet;
> message = "0x600000031300 <x-coredata://B63E5B93-8B0A-49C1-BC6A-D4C948A2CA61/Message/p2>";
> name = Bye;
> })
> )} of class _NSFaultingMutableOrderedSet
This error came up twice on app start. It came up once more when I tried clicking on the app icon.
—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
> On Feb 14, 2017, at 6:16 PM, Daryle Walker <email@hidden> wrote:
>
> I’m on macOS Sierra, running Swift 3 on Xcode 8.
>
> I started the basic document-based project, with storyboards but without Core Data. The main window has a table view and a text view. I connected them to my document’s data object with Cocoa Bindings. I put in sample data into the object and the window shows said data when run.
>
> Now I want to switch to Core Data. I made a framework with the data model file and the NSMangedObject subclasses (with slight tweaks). Usually, the developer would use all the whiz-bang features of Bindings, CD fetches, object controllers, and array controllers with the window. But I want the Core Data change and the window change to be separate Git commits. So I just replaced the name of my old data classes with my NSMangedObject subclasses.
>
> The views come up blank when run. During “makeWindowControllers,” I print out my top level data object, which is now of type “MyMangedObjectSubclass!”. I crash with a NIL-dereference error. I guess it’s somebody’s fault (pun totally intended). How do I give managed objects enough permanence to be used with systems expecting normal objects?
>
> [I’m at the stage where I know just enough to be dangerous, but not enough to know what I’m actually doing.]
_______________________________________________
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