Re: Core Data won't accept this string...
Re: Core Data won't accept this string...
- Subject: Re: Core Data won't accept this string...
- From: Fritz Anderson <email@hidden>
- Date: Tue, 03 Apr 2012 13:18:14 -0500
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