Thursday, January 29, 2009

Two way app integration on the iPhone

Ryan Johnson of Inner Fence wrote an interesting post recently that explains how to chain iPhone URL handlers to perform a simple kind of two way application integration. Inner Fence also has some sample code available that demonstrates this kind of integration with their Credit Card Terminal application.

Wednesday, January 21, 2009

Localizable.strings encoding

If you're developing iPhone applications and want to reach international markets, then you've probably learned about .strings files and the NSLocalizedString() family of macros. (If not, then look here.)

One small but important fact that I didn't find documented was the required text encoding for .strings files. I assumed that UTF-8 would work fine, and indeed, the iPhone simulator is happy with UTF-8 encoding. Unfortunately a real phone (running iPhone OS 2.2) silently ignores UTF-8 encoded .strings files. Seems that UTF-16 encoding is required.

You can convert a file in Xcode by ctrl-clicking in it, selecting Get Info and changing the File Encoding: drop-down and click the Convert button in the file encoding dialog.

Strangely enough however, the InfoPlist.strings file works fine whether encoded as UTF-8 or UTF-16, but it's probably best to be consistent and encode all your .strings files as UTF-16. Also, the genstrings utility only writes out .strings files as UTF-16, so it seems like the way to go.

Tuesday, January 20, 2009

Application developers see iPhone as way to get noticed

USA Today has an article titled "Application developers see iPhone as way to get noticed" that talks about the iPhone application market and how companies are making it part of their strategy. It's not very deep but touches all the bases.

Monday, January 19, 2009

iPhone, performance and C++

David at Savoy Software has an interesting blog post about how he optimized the performance of Spots by applying a little C++ knowledge and a better algorithm.

Friday, January 16, 2009

Text mode: title in a box

When I'm spiking on some experimental code, I often write a little command line application that spews out results to the console. The output can quickly become a sea of lines scrolling away in your terminal window. Drawing a dash and pipe box at the start of each run (or for each section of output) helps me scan through the output.

Here's a quick and easy way to draw and center a title in a dash and pipe box using printf():
void titleBox(char const *title) {
static char const border[] = "+------------------------------------+\n";
static int const borderWidth = sizeof(border) - sizeof("\n"); // minus '\n' and '\0'

int paddingWidth = borderWidth - strlen(title);
int leftPaddingWidth = paddingWidth / 2;
int rightPaddingWidth = paddingWidth - leftPaddingWidth;

printf("%-*c", leftPaddingWidth, '|');
printf("%*c\n", rightPaddingWidth, '|');
And the output looks like:
|              My Stuff              |

Thursday, January 15, 2009

iphone sdk mobile provisioning (0xe800003a, 0xe8000001, ...)

Getting an iPhone set up for development isn't trivial. There are encryption certificates and provisioning profiles and app IDs to manage. Apple did a decent job of adding topical help to the iPhone Developer Program Portal site; most sections have a "How To" tab that will walk you through each step of the process. If the "How To" tab doesn't cut it, I recommend Ralf Rottman's article "iphone sdk mobile provisioning (0xe800003a, 0xe8000001, ...)".

Wednesday, January 14, 2009

Writing iPhone apps discussions on Reddit

Redditis primarily a place where people post, vote and comment on links to cool and interesting stuff, but occasionally "redditors" simply start conversations on random topics. There were a couple of interesting posts from iPhone developers recently talking about their experiences publishing iPhone apps:

Monday, January 12, 2009

It's Official...

Able Pear Software Inc is now an official iPhone Developer! We were accepted into the iPhone Developer Program today.

This was a big step for us. We applied in early December, unfortunately right before the holidays, so our application moved slowly. But now we can actually deploy apps to real hardware for testing.

The process for doing this is fairly complex, but fortunately we haven't hit any snags yet that we couldn't overcome with a Google search or two. Now that we've jumped that hurdle, it's back to work on our apps.