Archive for February, 2010


Canada FTW!

Yep, we figure we’ll make today one of those exceedingly rare occasions with a completely non-computer-related post; because well, it’s just the right day today for a little Vancouver Olympics boosterism, even if you’re as profoundly cynical as a troll, isn’t it now? Hey, you just can’t really beat for a dramatic finale that sudden death overtime goal to take hockey gold, for a new Winter Olympics gold medal count record no less. Not like we could really get much of anything else done at the moment anyways, as outside the downtown Vancouver Trollwerks Inc. world headquarters, there are very many people in the streets, and they are very excited.


Very very excited.


Yes, it’s quite the time. As the slogan has it,


Indeed. Our condolences to all of you out there who are in cities that aren’t Vancouver. Although we’re sure that yours is very nice too. And almost certainly a great deal quieter, at the moment…


Switching from Core Data

Here’s a thoughtful piece on when not to use Core Data that’s worth reading:

… I optimized as much as I could, spent tons of time in Shark, went all multi-threaded with Core Data, switched away from my own queuing system to NSOperationQueue, optimized the XML parsing, etc. But performance and memory use on my first-generation iPod Touch (my development test device) was still not nearly good enough with a big unread count (of around 10,000 items).

At that point, having done everything else, the remaining issue was clearly Core Data. So I tried more things, re-read everything I could about Core Data performance (for the nth time), ran experiments, spent tons more time in Shark. Trying to get it good. No go.

Finally I realized I had to switch away from Core Data and use SQLite more directly. Not completely directly — I use FMDB, a lightweight Objective-C interface that works on Macs and iPhones. Gus wrote it. It’s good…

Definitely worth reading over before putting together anything with heavy data manipulation requirements, yep!

[UPDATE: And check out the other reactions that MobileOrchard collected!]


In-App Purchasing

Well, that was pretty much completely anticlimactic.

For several months now we’ve been, well, not avoiding exactly, but deprioritizing below “panic” level — which around here, means in schedule terms roughly “you’re kidding, right?” — learning all about in-app purchase for the upcoming single app revision of the Poses series, having read all over the place about how fraught with peril and puzzlement the process of implementing IAP was. But this afternoon it looked, wonder of wonders, like there weren’t any cataclysmic events on the horizon at least until Monday; so we figured that getting started on sussing out this IAP thing would be the best use of that time block…

… and it took us about four hours to implement.

So, it definitely is not necessarily as difficult as the more fevered rantings around teh intertubes would have you believe.

First off, log into the Dev Center and read thoroughly all the relevant documentation from the mothership.

Getting Started With In App Purchase

In App Purchase Programming Guide

iTunes Connect Developer Guide

Store Kit Framework Reference

Once you’ve read those: enable IAP for your app ID in the portal, create an entry for the app in iTunes Connect if it’s a new app, create some product IDs for your purchases, and create a test user. All reasonably straightforward. (If it doesn’t seem that way, hey read the following tutorials too before digging in.)

Then, take a read through this pair of tutorials from Mugunth Kumar’s blog

In-App Purchases

Enabling reviewers to use your in-App purchases for free

and grab the MKStoreKit V2.0 source provided therein. Provides a great big leg up on getting the entire payment process up and running, pretty much just substitute in your own product IDs and set a delegate to do whatever the consequences of purchasing are, if they’re more complicated than setting a user defaults flag.

And once you’ve got that basic implementation in place, read over this series from the FlowerGarden fellow on

Displaying Store Items

Selling The Goods

Anti-Piracy Measures

iTunes Connect

for a variety of useful advice.

And as a final note, StoreKit doesn’t get on that well with the simulator, so if that’s an issue for you, look into the SimStoreKit project, “a simulated version of the iPhone’s StoreKit, for testing store UIs on the iPhone Simulator, or even on device without having to set up IAP in Connect.” Didn’t need to try it ourselves, but hey it’s always nice to have options!


The above-mentioned MKStoreKit is now at version 3 with lots of new goodies!


Tip: Sanitizing RSS Feeds

So let’s say you’ve got what’s supposed to be a simple RSS feed you’re parsing with NSXMLParser — but the clowns that put it together insist on providing it with strange Windows characters embedded in the text, so the parsing consistently chokes with illegal character errors. And, of course, the suggestion of getting Windows people to display even minimal competence on their end, well that’s just crazy talk. So, what to do? What to do?

Well, here’s a quick and easy trick to sanitize the offensiveness right out:

NSString *dataString = [[[NSString alloc] initWithData:rawFeedData encoding:NSASCIIStringEncoding] autorelease];
NSData *sanitizedData = [dataString dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];

Hey, worked for us!

h/t: StackOverflow!


iPhone Facebook URLs

So seems everyone wants to integrate their iPhone apps with Facebook these days; and it may be of interest to you to know that there’s some undocumented options to the Facebook iPhone app’s custom URL scheme to control its behaviour:

  • fb://profile – Open Facebook app to the user’s profile
  • fb://friends – Open Facebook app to the friends list
  • fb://notifications – Open Facebook app to the notifications list (NOTE: there appears to be a bug with this URL. The Notifications page opens. However, it’s not possible to navigate to anywhere else in the Facebook app)
  • fb://feed – Open Facebook app to the News Feed
  • fb://events – Open Facebook app to the Events page
  • fb://requests – Open Facebook app to the Requests list
  • fb://notes- Open Facebook app to the Notes page
  • fb://albums – – Open Facebook app to Photo Albums list

Now, what you’re really looking for no doubt — at least, that’s what we were looking for today — was trying to figure out how to get the user to be able to join a particular fan page more elegantly than loading its URL in Safari, because of course your typical iPhone user probably isn’t logged into the browser, since well there’s this native app and all.

Well, this followup post to the above claims you can do that by adding the fan page’s ID to fb://profile as a path. BUT IT LIES. Maybe the procedure described worked with whatever version was current when that was written … but with 3.12 the latest as of today, nope you can only open to your own profile; trying to load someone else’s fan page we find this — or any other sensible attempt we can think of to pass a designated page ID — fails. Bah.

Anyone out there manage to get this to work with other people’s fan pages? Or come up with some better way to handle the ‘join fan page X’ design requirement than just passing its URL off to Safari? If so, please share!


M Cubed goodies

Hey, here’s something we hadn’t noticed before; those fine fellows over at M Cubed Software who make the most excellent Lighthouse Keeper — yes, a year and a half after we set it up it’s still running our daily operations here — have a page with all sorts of goodies for the Cocoa developer worth taking a gander at. Particularly interesting is M3TokenController:

M3TokenController is a set of classes that lets you add a token cloud to your application that integrates with NSTokenField to manage tokens within your UI, similar to what is found in Lighthouse Keeper.


also, down at the bottom, note M3BezierPath for the iPhone programmer:

M3BezierPath is a port of the NSBezierPath class to the iPhone. It isn’t fully complete (see the header for methods that aren’t implemented yet) but covers the most commonly used parts of NSBezierPath.

… but there’s lots of other goodies to sort through there as well!


Maid Clock

Ah yes, we’d forgotten to mention this; there’s another troll program up on the App Store these days! Well, “another” may be stretching it a bit, as it’s a new release of the previously mentioned Anime Clock with new graphics. And these new graphics, of course, are definitely going to break with the increasingly established tradition of troll-written programs featuring scantily clad attractive women, aren’t they? Weeellll, it turns out this version is called Maid Clock, so …


… not so much, no. Yep, even without our active involvement in any way whatsoever, they just keep on coming. But hey, we’re always delighted to do our part to celebrate Japanese culture. Indeed, we do thoroughly recommend that should you ever visit Japan, you do make a point of checking out a maid café or dozen; it is an extremely unusual scene to those of us hailing from a culture which is … well, any that’s not Japanese, really. When we were over there a few weeks back visiting the great people at Wayz that we’ve done a selection of applications for, it was made certain of that we didn’t miss out:


Yes, yes, the life of an iPhone programmer is a difficult and straining one, indeed. Thank you for all your sympathies. But hey, while you’re gearing up to visit Japan … you can always get the clock!



Template: Newsreader

Feel like doing a newsreader style iPhone app? Well here we have for you something even better than sample code … an actual Xcode project template.

… The project is a starting point for creating your own tab-based newsreader apps: it includes a tab bar with 4 buttons each linked to a table view which you can fill with headlines.

Simply add a data model for your news feeds, then modify each pane’s controller class to display the data in the table view. Edit the 4 tab bar item icons, Default.png, and app icon to match your app’s theme, and you’re done.

Now that’s convenience, indeed!


Static Library Sharing

If you’re trying to share a static library between iPhone and OS X projects — here’s how to go about it, demonstrated with openssl:

… The Release build process sets up a universal binary. Thus, using the common technique described above, the linker ends up trying to link a PPC build of your binary against our static openssl library, which was only building either i386, or ARMv6. If you are using the code and instructions we described in our SQLCipher tutorial to use SQLCipher in your iPhone project, and you decide to use that technique for a Mac OS X project, this problem will affect you (if you are building the standard universal binary on release builds)…

Handy stuff to figure out; or, if it actually is openssl in particular you’d like to share, simply grab openssl-xcode off github!

h/t: iPhoneFlow!


NimbleBit Numbers 2009

Here is a really really excellent post on App Store returns for an indie iPhone game developer, NimbleBit to be exact:

… Seven months later I can still safely argue that there exists a comfortable and sustainable grey area between million dollar jackpots and ramen noodle dinners. As before we’re releasing the numbers for our games in the hopes that their analysis will be helpful to other indie developers. This numbers article will focus more on what worked in 2009, what mistakes we can learn from, and how we intend to keep the ball rolling in 2010…

Good stuff, read it all the way through if you’re planning on doing an indie iPhone game. Hey, even if you’re not, it’s still pretty interesting no doubt!

h/t: MobileOrchard!