• 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 won't accept this string...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data won't accept this string...


  • Subject: Re: Core Data won't accept this string...
  • From: James Cicenia <email@hidden>
  • Date: Tue, 03 Apr 2012 14:04:28 -0500

Thank you for taking the time to answer. Sorry about the declarative question mark.

I guess I just needed a sanity check. I inherited a NSManagedObject category that was being too aggressive
in converting everything to Dictionary. So, I turned that value back into an NSString and it worked.

Thank you for your time.

- j-

On Apr 3, 2012, at 1:18 PM, Fritz Anderson wrote:

> On 3 Apr 2012, at 12:11 PM, James Cicenia wrote:
>
>> I am trying to import data into Core Data. I am trying to set the value of one the attributes to the following string:
>>
>> MeasureID = 2376;
>>   Property =     {
>>       root =         {
>>           ExtendedProperties =             {
>>               item =                 {
>>                   "@id" = PhotoRequired;
>>                   text = 0;
>>               };
>>           };
>>       };
>>   };
>
> This appears to be a text property list, almost. You don't include the outer brace pair. How do you read this "string," and how are you applying it to a managed object?
>
>> It takes the MeasureID but no matter what I do it won't take the String in Property?
>
> What "takes" it? The managed object?
>
>> And worse, the following code:  [self setValue:value forKey:attribute]; Just swallows it and doesn't throw any errors ?
>
> What is "value?" How is it obtained? Have you examined it in the debugger (or through an NSLog()) to verify it isn't nil?
>
>> Is the fact that it looks like an array or dictionary throwing off NSManagedObject?
>
> Nothing in Cocoa interprets plist data unless you explicitly put it through a serializer, such as the array- or dictionary-with-contents-of-file initializers or the NSPropertyListSerialization class.
>
> But you apparently want Measure/Property to be interpreted as dictionary key/value pairs (net of the absence of enclosing braces), but you don't want to interpret the dictionary assigned to Property. The deserializers don't work that way; they convert the nested structures to arrays and dictionaries all the way down.
>
> You'll have to show us your actual code. What's happening depends on what you're actually doing, and a narrative description of what you meant to do doesn't tell us enough to know what you did.
>
> And please don't tack question marks onto the ends of declarative sentences.
>
> 	— F
>


_______________________________________________

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: 
 >Core Data won't accept this string... (From: James Cicenia <email@hidden>)
 >Re: Core Data won't accept this string... (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: Core Data won't accept this string...
  • Next by Date: How to bind to NSMutableArray that may contain zero objects?
  • Previous by thread: Re: Core Data won't accept this string...
  • Next by thread: Core Data and ARC crasher and workaround
  • Index(es):
    • Date
    • Thread