• 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: Getting rid of primitive accessor warnings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting rid of primitive accessor warnings


  • Subject: Re: Getting rid of primitive accessor warnings
  • From: Fritz Anderson <email@hidden>
  • Date: Thu, 01 Nov 2012 10:24:03 -0500

On 1 Nov 2012, at 9:55 AM, Keary Suska <email@hidden> wrote:

> This is normal and expected, as it is a default warning (at least on OS X). What is the problem, exactly? There is no value whatsoever that I know of to declare primitive accessors if you don't intend to implement them. Furthermore, you shouldn't need to declare primitive accessors at all as they should not be publicly called. Or in other terms, exposing them is probably a code smell. In any case, Core Data synthesizes them for you anyway….

I haven't needed to call primitive accessors in a while, but the fact that Core Data synthesizes them at run time doesn't mean the compiler knows that the methods exist. Last I looked, you had to declare a category containing the primitives the class's own code (not the general public's) needed to call, or the compiler would complain as the OP said.

Takeaway:

Declare the primitive accessors so the compiler won't complain about their use.

Declare them in a category so the compiler won't complain that the main implementation doesn't contain their definitions.

It would be neat if clang inferred the existence of primitives from the presence of dynamic properties in an NSManagedObject subclass, so declaration wouldn't be necessary, but I haven't tried it.

	— F

--
Fritz Anderson -- Xcode 4 Unleashed: 4.5 supplement in the works -- <http://x4u.manoverboard.org/>


_______________________________________________

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: Getting rid of primitive accessor warnings
      • From: Rick Mann <email@hidden>
    • Re: Getting rid of primitive accessor warnings
      • From: Keary Suska <email@hidden>
References: 
 >Re: Getting rid of primitive accessor warnings (From: Keary Suska <email@hidden>)

  • Prev by Date: Get NowJS work
  • Next by Date: Re: Mystifying index out of bounds error
  • Previous by thread: Re: Getting rid of primitive accessor warnings
  • Next by thread: Re: Getting rid of primitive accessor warnings
  • Index(es):
    • Date
    • Thread