• 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
Are instances of a NSManagedObject subclass usable as regular objects?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Are instances of a NSManagedObject subclass usable as regular objects?


  • Subject: Are instances of a NSManagedObject subclass usable as regular objects?
  • From: Daryle Walker <email@hidden>
  • Date: Tue, 14 Feb 2017 18:16:15 -0500

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.]

—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT 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


  • Follow-Ups:
    • Re: Are instances of a NSManagedObject subclass usable as regular objects?
      • From: Jens Alfke <email@hidden>
    • Re: Are instances of a NSManagedObject subclass usable as regular objects?
      • From: Daryle Walker <email@hidden>
  • Prev by Date: Re: Sometimes all my menus are disabled
  • Next by Date: Re: Are instances of a NSManagedObject subclass usable as regular objects?
  • Previous by thread: Re: makeKeyAndOrderFront not working
  • Next by thread: Re: Are instances of a NSManagedObject subclass usable as regular objects?
  • Index(es):
    • Date
    • Thread