Getting Values from fetched Core Data

Posted by user571905 on Stack Overflow See other posts from Stack Overflow or by user571905
Published on 2011-01-12T03:38:43Z Indexed on 2011/01/12 3:53 UTC
Read the original article Hit count: 166

Filed under:
|

Hi there,

Thanks to the wonderful people on this forum, I have overcome most of my Core Data woes.

However one persists, and I'm certain it is a simple fix.

I have a recipe app that parses an XML doc on load and puts the data in Core Data.

Then I search that Core Data for particular recipes, ingredients, etc.

Everything is working with one exception... I cannot do anything with the data I retrieve.

For example, I search the core data for "eggplant" and get this at the end of the process:

  "<RecipeData: 0x6112a40> (entity: RecipeData; id: 0x6113880 <x-coredata:///RecipeData/tCDE9A0EE-DA3F-4BD0-AEF8-3C038586991D4> ; data: {\n    ingredients = \"Eggplant|Cheese|Tomatoes|\";\n    name = \"Eggplant Parm\";\n    time = 40;\n})"

How do I get the info out of there? I tried looping through, but that causes the app to crash:

for (NSString* key in selectedRecipe) {
        id value = [selectedRecipe objectForKey:key];
        NSLog(@"IN LOOP: %@", value);

    }

Any suggestions?

Thank you for your time.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c