Skip to content

Author Archives: Jeff LaMarche

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.
Continue Reading: Core Data and Threading →

The Martian Invasion: Announcing MartianCraft

About four months ago, I joined together with my friend and co-author, Dave Mark and with Rob Rhyne, developer of the awesome Briefs prototyping tool, to form a new mobile software development company specializing in the iPhone and Android platforms. T…

Continue Reading: The Martian Invasion: Announcing MartianCraft →

Downloading Images for a Table without Threads

It is common practice in many networking libraries in many languages to spawn threads to handle asynchronous communications in the background while the rest of the program continues to function. Although this approach does work on the iPhone, it’s real…

Continue Reading: Downloading Images for a Table without Threads →

Pre-WWDC Pilgrimage Sign-Up

If you think you’re interested in traveling from Downtown San Francisco to One Infinite Loop, Cupertino on Saturday Sunday, June 6th to go to Apple’s Company Store, or if you live in the area and just want to join us for lunch, please fill out this que…

Continue Reading: Pre-WWDC Pilgrimage Sign-Up →

Gradient Buttons Yet Again

I added two more button styles to the iPhone Gradient Buttons project and made stroke color and stroke weight configurable options. The two new styles look exactly like the old Black and White style, only the highlight state is a blue gradient. These simulate the style used in alert sheets in several Apple applications.

Screen shot 2010-05-21 at 4.29.17 PM.png

Some of the Core Graphics code was machine-generated and is in kind of rough shape, but it works. I’m thinking about refactoring the different styles methods into something shorter, perhaps a plist, or just C arrays with the different numeric values.

For some strange reason, when I try to use arrayWithObjects: instead of creating a mutable array and manually adding the colors one at a time, I get a NULL gradient back. I have no idea why, but it’s working this way at least.

Anyone who wants to contribute, let me know, I’d be happy to add committers.

©2008-2010 Jeff LaMarche.
Continue Reading: Gradient Buttons Yet Again →

The Illusion of Open

Today, on Twitter, I’ve been having some back and forth with John Wilker, one of the founders of the 360|iDev Conferences about Android and the concept of “openness”. The discussion really helped to clarify some of my thoughts on the matter (thanks, John!).

Now, I’ve been somewhat harsh on Android at times, but the things I’m harsh about are details and personal programming platform preferences. It’s actually a pretty good platform with a huge amount of potential. It now appears to have reached the critical mass needed to really propel it forward, and I do have high hopes that it will keep moving forward, getting better, and pressuring Apple to do even more amazing things than they would have otherwise done.

Yesterday, Google IO ended, and it was clear from the tone of the conference that Google is planning to put up some fierce competition to Apple on several fronts, and that’s good. A lot of Google’s pitch was focused on this idea of “openness” – that Google’s stuff is inherently more “open” (except, of course, the stuff they make money from, but that’s a whole separate topic) and therefore better for the user. Tim Bray, Google’s Android Evangelist, went off on a rather enthusiastic but somewhat silly Twitter rant a few days ago about openness and the “curated experience” of the iPhone. It’s clear that Google sees “openness” as a competitive advantage over Apple and has made it their battle cry in the mobile space.

But, not too long ago, Google announced that it was ending direct sales of their phone, the Nexus One.

Here’s the reality of the Android situation now: if you buy an Android phone, it will most likely be locked down by your carrier, possibly also with some features disabled. Or, to use Tim Bray’s term, the reality is that most Android phones that get bought are a “curated experience”.

In some places, some carriers will sell unlocked phones, but for a great many people, if you want an open Android phone, you will be required to buy one from a carrier and jailbreak it, which is likely a violation of your subscriber agreement. If you don’t jailbreak it, you may not get future Android updates. If you buy an Android phone and don’t jailbreak it, you might spend the entire life of your phone using the Android version that shipped on it. Your vendor could even charge you a ridiculous monthly fee for the upgrade, something that at least Verizon has considered doing. Even if your carrier does provide updates for free and regularly, there will be a delay as the vendor and provider add all their customizations and restrictions on top of the official Android release.

For the vast majority of people who will buy Android phones, “open” is an illusion because now that Google has abandoned their direct sales model, Android firmly puts the final decision making power for the overall experience of the phone back into the hands of the traditional carrier/vendor relationship that ruled the space before the iPhone came out. Apple, unlike other phone vendors, is capable of going toe-to-toe with the carriers and is willing to do so to fight for a better user experience. That’s why we don’t have AT&T branding all over our iPhones. That’s why we don’t have the mandatory 15-second spiel before voicemail that Verizon users have to suffer through. Apple is at least an equal partner with the carriers who sell their phones. Most of the other phone vendors, to put it bluntly, are the carriers’ bitches.

Does Android have some nice features that the iPhone doesn’t? Absolutely. Is Android improving? No doubt about it and on a regular basis to boot. But, by putting the real power back in the hand of the carriers and their vendor partners, the user experience is never going to be as important in the decision making process as it is for the iPhone. Even if the Android team manages to make the overall experience better than the iPhone (which I consider unlikely, but possible), the carriers will almost certainly screw it up with their ham-handed customizations and restrictions.

If you’re going to have a curated experience, isn’t it better to at least have one where the curator is making their decisions primarily around the quality of your experience?

Unless Google resumes direct sales or puts licensing limitations on the carriers to prevent them from locking down Android phones, “open” will be just another empty marketing slogan. And I suspect that’s what it will be. Google doesn’t really care about the user experience, they just want to keep making money on their proprietary, non-open advertising in the mobile space the way they have on the web, and the more Android phones that are out there, the more phones that will be getting Google Ads. Hell, Google even discussed the possibility of unblockable ads at Google IO!

Right. Nothing screams “open” like unblockable advertisements served using proprietary algorithms based on personal data that’s been collected about what you do online.

©2008-2010 Jeff LaMarche.
Continue Reading: The Illusion of Open →

WWDC Trip to Cupertino Update

There has been quite a lot of interest shown in traveling down to One Infinite Loop to go to the Company Store on the Sunday before WWDC. I’m going to put something together this weekend to serve as a “signup sheet”. I’m going to solicit information about who has cars and how many spare seats there are, what time people are arriving, etc. We’ll give people a few days to sign up, then we’ll formulate a plan for getting as many people down there as we possibly can.

©2008-2010 Jeff LaMarche.
Continue Reading: WWDC Trip to Cupertino Update →

Improved Gradient Buttons

I’ve been playing around a bit, improving my imageless gradient button class. The new version allows you to specify the gradient for the normal and highlighted state by populating two arrays, one with the colors that make up the gradients and another with the relative location for each color. I’ve gotten rid of the abstract parent class and individual child classes and all the functionality is now contained in a single class.

Screen shot 2010-05-19 at 11.48.50 PM.png
There are five built-in styles which can be seen in the image above, or you can manually set the gradient to any value you’d like. You can download the source codes from the Google code page. There are no restrictions or limitations on its use.

The easiest way to use these is to add a UIButton instance to your view in Interface Builder, then change the underlying class from UIButton to GradientButton. Because there’s no way to create IB palettes for iPhone classes, you’ll also have to implement viewDidLoad and set the gradient or use the existing methods there.

©2008-2010 Jeff LaMarche.
Continue Reading: Improved Gradient Buttons →

Pre-WWDC Cupertino Trip

There’s been a bunch of discussion over Twitter today about getting down to One Infinite Loop on Sunday, June 6th, the day before WWDC starts. Typically, The Company Store (Apple’s on-campus store, open to the public) is open that day even though they are not usually open on the weekends. I called the store this morning, and they are going to be open again this year from noon to 5:00pm.

It is not possible to get all the way from San Francisco to Apple’s Corporate HQ completely on public transit, so the logistics could be a little daunting, but one possibility would be to charter a bus down. In the long run, it might save some money while being faster and more comfortable.

Chime in in the comment section if you’re interested in going from downtown San Francisco down to Cupertino on Sunday, June 6th and don’t have a way to get there yet. If there’s enough interest, I’ll look into what it would cost to get arrange transportation based on the number of interested people.

The other option would be to set up a big carpool.

©2008-2010 Jeff LaMarche.
Continue Reading: Pre-WWDC Cupertino Trip →