Skip to content

Category Archives: Cocoa API

Objective-C – Apple’s Variation on the C Universe

Objective-C was written in the early 1980s. It was designed as a way of introducing the capabilities of the Smalltalk language into a C programming environment. A majority of the iPhone’s framework libraries are written in Objective-C, but because the language was designed to accommodate the C language, you can use C and C++ in […]

Continue Reading: Objective-C – Apple’s Variation on the C Universe →
Cocoa Touch Introductory Overview For Programmers Brought Up on C

Cocoa Touch is the crafty little software that takes care of the touchy-feely side of the iPhone, iPad and iPod Touch’s customer appeal. With the iPad now flying off the shelves faster than Apple can keep up, this is going to be a software that’s essential in any application developer’s repertoire. In many ways it covers the gaps in Objective-C’s programming that prevent it from being completely capable of running an iPhone.

Continue Reading: Cocoa Touch Introductory Overview For Programmers Brought Up on C →
Core Data and Threading

I’ve had a number of people ask me lately about the best way to handle using Core Data in a multi-threaded application. I began to put together a tutorial and sample code based on Apple’s documentation, which advises to pass NSManagedObjectIDs between threads to get around the fact that threads can’t share instances of NSManagedObjectContext or NSManagedObject. I’ve used this approach in several projects and it works.

While googling around doing research, however, I came across a post by Marcus Zarra on the Mac Developer Network.

Marcus knows Core Data really well, having written a book on the topic, so I figured I’d take a look at what Marcus had to say on the matter. I’m glad I did. Marcus illustrates a really great approach in his post that obviates the need to pass ManagedObjectIDs around between the thread in many situations. You still need to do that if you need to pass a specific object between threads, but if you’re doing something like loading or creating managed objects in the background to be displayed in a table, this is so much easier and better.

I won’t spoil the surprise, but it’s a handy tool for your Core Data toolkit. If you have any thought about using Core Data in a multi-threaded application, you should definitely check it out.


©2008-2010 Jeff LaMarche.
http://iphonedevelopment.blogspot.com
Continue Reading: Core Data and Threading →