• 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: CoreData problem - AttributeDescription seems invalid --- Where am I wrong?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData problem - AttributeDescription seems invalid --- Where am I wrong?


  • Subject: Re: CoreData problem - AttributeDescription seems invalid --- Where am I wrong?
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 01 Jun 2011 21:10:47 -0700

On Jun 1, 2011, at 13:26, Motti Shneor wrote:

> - (NSMutableDictionary *)attributesAsDictionary {
> 	NSMutableDictionary *attributesDictionary = [NSMutableDictionary dictionaryWithCapacity:[self.entity.attributesByName count]];
> 	for (NSAttributeDescription* attribute in self.entity.attributesByName ) {
> 		NSString *attribName = [attribute name];
> 		id attribValue = [self valueForKey:attribName];
> 		if (attribName && attribValue)
> 			[attributesDictionary setObject:attribValue forKey:attribName];
> 	}
> 	return attributesDictionary;
> }
>
> Running this for a nice entity that I just Saved (validated) and Fetched again --- the method crashes horribly on the NSString *attribName = [attribute name];
>
> If I step inside with the debugger, I see things I can't understand.  I get into the loop, and for the first attribute ---
> 1. Debugger claims  attribute type is CFStringRef * instead of  NSAttributeDescription*

You have to read the documentation. 'attributesByName' returns a dictionary, and enumerating a dictionary with 'for (... in ...)' enumerates the dictionary keys, which are indeed strings in this case.


_______________________________________________

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

References: 
 >CoreData problem - AttributeDescription seems invalid --- Where am I wrong? (From: Motti Shneor <email@hidden>)

  • Prev by Date: Issue with NSRunLoop
  • Next by Date: Re: How to create outlets in a cocoa category
  • Previous by thread: CoreData problem - AttributeDescription seems invalid --- Where am I wrong?
  • Next by thread: Notify With Parameters
  • Index(es):
    • Date
    • Thread