I’m starting CS193p this new semester again because the Assignment this time around is Paparazzi, a Flickr client which uses CoreData and it’ll be a good experience!

I’ve started with the static view controllers and noticed I was a little rough around the edges in alloc/initting view controllers (mainly nav and tabbar). However I got thru it.

Then I moved on to Part 2 where you use the plist file to populate the CoreData model which is where I am currently and am stuck!

This time around, unlike the Twitter App, we have to use the plist file to populate the db. I’ve got the object model set up, which by the way, I figured out I can write the class files for person and photo in Paparazzi as for person in Presence and then create a CoreData object model by “importing” those class files! Except now I don’t know if i still need those class files.

So to populate the db we must read the plist file which is an array of dictionaries, right?

Figured it out with a little help (from my friends @the google auditors group).  Its definitely a seasoned programmers trick even though the guy who helped me claims to be a newbie 🙂 :

for (NSDictionary *dict in twitterIds) {}

I couldn’t figure out how to cycle thru the dictionary that was inside the array.  So this worked beautifully.

TWO important concepts:

1) Singletons: Are like the UIApplicationDelegate class.  They are special classes which have certain methods you want to import or access from other class files (which provide certain functionality) and its not bound to your UIApplicationDelegate.  So you dont violate that rule of thumb.  Basically you declare a sharedInstance of that singleton class “FlickrFetcher” in your code, then you can being to call all methods from that class.  I guess later on ill understand why we dont just adopt the class as a protocol, which would seem to me to provide the same functionality.

2) CoreData: Aside from your singleton class declaring the moc, mom and psc…you need to declare a new moc in the class where you will be using the code you ‘access via singleton’.  Then you allocate your objects just like any Class Object Files as the Person objects in Presence from last semester and start using them.  Dont forget to save them to the psc, dont just leave them in the moc or youll lose them 🙂

Leave a Reply