• 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
Using an empty string as the default value for a Core Data attribute in the XCode modeller
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using an empty string as the default value for a Core Data attribute in the XCode modeller


  • Subject: Using an empty string as the default value for a Core Data attribute in the XCode modeller
  • From: Frank Reiff <email@hidden>
  • Date: Wed, 5 Sep 2007 12:33:48 +0200

Hi,

I'm fairly new with Core Data and I've run into a problem with string default values.. any help would be appreciated.

In the modeling view, you can supply default values for each entity attribute. I want a string attribute with default value @"" (not null/ nil):

I simply unticked the "optional" checkbox and left the default value field blank, thinking that this ought to do the trick.. unfortunately I promptly get a validation error when I try to quit the program without supplying a value; I leave all other fields untouched so it's not a reg. ex., min or max length problem. Supplying a different default value makes the validation error go away.

My guess is that leaving the default value field blank means "no default value" rather than "use the empty string as the default value", but that will mean that I either have to programmatically set the default value to @"" or need to test every time I read this attribute whether it is null or contains a string. Both of those seem to go against the grain of putting default values and validation into the model rather than the code..

Is there any trick to use the modeler to supply @"" as a default value? I find it hard to type an empty string ;-)

Thanks for your help.

Best regards,

Frank
_______________________________________________

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: Using an empty string as the default value for a Core Data attribute in the XCode modeller
      • From: mmalc crawford <email@hidden>
    • Re: Using an empty string as the default value for a Core Data attribute in the XCode modeller
      • From: email@hidden
  • Prev by Date: Re: How to: Address Book-like text UI
  • Next by Date: Re: Attributed Strings in Distributed Objects
  • Previous by thread: Re: How to: Address Book-like text UI
  • Next by thread: Re: Using an empty string as the default value for a Core Data attribute in the XCode modeller
  • Index(es):
    • Date
    • Thread