• 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
Re: Core data accessors for structs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core data accessors for structs


  • Subject: Re: Core data accessors for structs
  • From: Jim Correia <email@hidden>
  • Date: Tue, 26 Jun 2007 12:48:36 -0400

On Jun 26, 2007, at 2:21 AM, MH wrote:

What is the best way to encode a struct so as to obtain persistence using
the Core Data framework, and avoid the pitfalls mentioned?


Should I be following the non-object guidelines supplied by Apple, and use
shadow attributes? This doesn't seem to address the problem mentioned by
Jim

Whether or not you use a shadow attribute, or on-demand encode/decode is going to depend on your specific needs. There are several patterns discussed in the documentation.


What are your reasons for using a structure? If it is for raw performance, you probably don't want to on-demand encode/decode the value every time the accessors are used. If you don't have a compelling reason for using a structure, you may want to consider changing the model.

As for the encoding issue, you have several options for encoding your structure in a way that will allow you to easily use the result on a platform with different endianness, integer sizes, structure padding, etc.. One solution is to use NSKeyedArchiver and individually encode/ decode the fields of the structure.

Jim

_______________________________________________

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: Core data accessors for structs
      • From: Kaelin Colclasure <email@hidden>
References: 
 >Core data accessors for structs (From: MH <email@hidden>)
 >Re: Core data accessors for structs (From: Charles Steinman <email@hidden>)
 >Re: Core data accessors for structs (From: MH <email@hidden>)

  • Prev by Date: Re: ObjC 3D engine
  • Next by Date: Re: Adding files to iTune library in Cocoa app
  • Previous by thread: Re: Core data accessors for structs
  • Next by thread: Re: Core data accessors for structs
  • Index(es):
    • Date
    • Thread