views:

100

answers:

1

What I'm trying to build is an application that allows users to add a category to the first entity (CategoryItem) and then add feeds to that via a second entity (FeedItem).

So far, the CategoryItem entity has *action attribute which is used as the naming of the category (String). The FeedItem entity has two attributes, *feedName and *feedURL, both strings.

I have already coded everything to allow the user to create a new category in the first entity, but once that is done and added into the UITableView which is reloaded, I want to allow the user to click the disclosure button which will push a new ViewController that allows the addition of feeds (FeedItem) to the second entity. Once hitting done, this feed is then added to the appropriate first entity (CategoryItem).

My question is how do I link the FeedItem entity to the CategoryItem via a relationship? Then how do I do the above, allowing the user to click the disclosure button of the added CategoryItem push a new ViewController that then allows the addition of the FeedItem.

This pushed ViewController would need two input boxes and a button (extremely simple to add) that would then write the values to the *feedName and *feedURL attributes.

The rest of the application I can do myself, such as parsing the RSS feeds using the TouchXML library. At the moment I'm just a little stuck on the way we can manipulate Core Data in Objective-C.

Any help would be appreciated!

[EDIT: If someone could post any tutorials/links that detailed this in depth it would be appreciated. However, please don't link to the iOS resource docs, I've already gone through them multiple times now.]

A: 

A possible implementation to get what you need would be:

  1. Add a "To-many" Relationship to the CategoryItem called "feeds";
  2. Add a Relationship to the FeedItem called "category";
  3. Set the inverse relationship of "feeds" to "category" (or vice-versa);
  4. Instantiate a new FeedItem managed object every time you push a new "Add FeedItem" ViewController;
  5. Save the managed object context after pressing "Done".

If you've already read all the resource documents, you could study the sample code, especially "Locations" and "CoreDataBooks". Hope this helps.

filjedi
Thank you heaps, you got me delegating everything right and I seem to be on the right track. However, is it possible you can aid in the initiating of the new FeedItem in the pushed ViewController?
the0rkus