Under The BridgeUnder The Bridge

Musings
Code: UITableViewCell-Compatibility

[EDIT: Discontinued.]

If you’re trying to maintain iPhone source that uses UITableViewCell — and really, what doesn’t? — across 2.x and 3.x OS version targets, here’s a helpful set of functions for OS version agnosticism from the redoubtable Erica Sadun:

@interface UITableViewCell (Compatibility)

- (void) setLabelText: (NSString *) formatstring, ...;

- (void) setDetailText: (NSString *) formatstring, ...;

- (UILabel *) getLabel; // not 2.x friendly, iffy workaround

- (UILabel *) getDetailLabel;

+ (id) cellWithStyle: (uint) style reuseIdentifier: (NSString *) identifier;

// Must be called during tableView:willDisplayCell:forRowAtIndexPath:

- (void) rectifyDetailLabel;

@end

Handy, that. And whilst checking out her site, we also note that iPhone Developer’s Cookbook 3.0 Edition code is now up at github as well. Goodies everywhere!

h/t: iPhoneSDK!

Library: geo-location-javascript

Here’s a library of interest to our web-developing friends; geo-location-javascript, which wraps a number of different device’s GPS capabilities into a JavaScript API that is “aligned” to the W3 Geolocation API specification:

Usage Scenario

The framework provides two key methods, it determines if the handset has client side geo location capabilities and one method to retrieve the location (of course only after a request for permission). So a mobile web site that provides location based services can first determine if the client has client side geo capabilites and ask him to assist him in finding his location. If no geo capabilities are given or they are disabled the site can fallback on a manual location input method and use a geodata database/service to map the input to a pair of latitude/longitude coordinates.

Supported platforms

  • iPhone OS 3.x
  • Browsers with Google Gears support (Android, Windows Mobile)
  • Blackberry Devices (8820, 9000,…)
  • Nokia Web Run-Time (Nokia N97,…)
  • webOS Application Platform (Palm Pre)
  • Torch Mobile Iris Browse
  • Mozilla Geode

A comprehensive — nay, well-nigh exhaustive — list of platforms indeed!

As a side note, if you’re unfortunate enough to be stuck on a Windows platform and would like to have an iPhone (and Pre, and …) emulator to test out your webpages, there’s this MobiOne thing which looks like it could be useful for you, check it out.

h/t: iPhoneWebDev!

Source: XPilot

Here’s another GPL’d game ported to the iPhone, like World Challenge that we mentioned earlierXPilot, an old school multiplayer game that now has a new lease on life. But, as we pontificated in the World Challenge notes, there are those who have issues with this kind of resurrection; and in this case, it includes one of the original developers. From the Slashdot article “The Ethics of Selling GPLed Software For the iPhone”:

…We priced it at $2.99 on the App store (we don’t expect it to become the Next Big Thing, but hoped to recoup our costs — such as server charges and Apple’s annual $99 developer fee), released the source on our web page, then enthusiastically tracked down every member of the original community we could find to let them know of the hoped-for renaissance. Which is where things got muddy. After it hit the App store, one of the original developers of XPilot told us he feels adamantly that we’re betraying the spirit of the GPL by charging for it.

This would be the kind of person that Fake Steve Jobs coined the term ‘freetard’ for. The GPL not only doesn’t mandate a price of nothing, it explicitly allows the charging of whatever fee you see fit for distribution, so long as all source is made available. So nobody serious believes that said original developer has any point. But it does bring up where the real debatable point is, since you can’t recompile on your own phone or redistribute through the App Store without the $99/yr licensing fee by Apple, does that constitute a violation? If you read through the 581 and counting comments, you’ll see every shade of opinion … including a link to the one that we can take as authoritative, I have no doubt: Brett Smith. And who is Brett Smith, you ask? Why, he’s the “Licensing Compliance Officer” for the FSF. Seems that this subject was brough up last year with him over at Linux.com, and here’s the scoop: There is no barrier the FSF sees to GPLv2 compliance. However, GPLv3 is off the table:

…The iPhone Developer Program establishes Apple as the sole provider of iPhone applications. You can choose not to charge for an app you author, but the iTunes Store is the only channel through which it can be delivered to end users and installed. Apple signs the apps it approves with a cryptographic key. Unsigned apps won’t run on the iPhone.

This condition conflicts with section 6 of the GPLv3, the so-called “anti-TiVoization” provision. In particular, it prohibits Apple from distributing a GPLv3-licensed iPhone application without supplying the signing keys necessary to make modified versions of the application run, too.

Thus, you as the developer could attempt to place your code under the GPLv3, but Apple could not distribute it — and since only Apple-signed programs will run, no one else could distribute it either.

The FSF’s Smith says the fact that the author of the program (i.e., you) and the distributor of the binary (i.e., Apple) are unrelated entities makes no difference. “If a program is meant to be installed on a particular User Product, GPLv3 imposes the same requirements about providing Installation Information whether the software is directly installed on the device or conveyed separately.”

Because of the GPL’s viral nature, any app that is derived from other GPLv3 code must be licensed in a way that preserves GPLv3’s code signing requirement. But there are still projects that have chosen to retain earlier licenses, such as GPLv2, and prior versions of the GPL did not include the code signing requirement. Thus you could in theory place your work under GPLv2, as long as it was either entirely original or derived only from code licensed under GPLv2 and earlier…

So there you go, we’ve got that question officially settled then; any program licensed under GPLv2 is cool with the FSF for the App Store, long as you make the source available. Excellent. Soon as we find some free time under the couch or something we will definitely look at picking a project like these to port to the iPhone for the benefit of those who enjoy rooting through code written by their potential contract trolls.

In the meantime, support these fellows’ trailblazing efforts, pick up what all the fuss is about for a mere $1.99!

XPilot

Keypad codes

Here’s an article with a bunch of keypad codes you can enter into your iPhone to get all sorts of interesting network and settings statuses. Apparently most of them aren’t actually iPhone-specific, with the exception of this one,

*3001#12345#*– Opens up the “Field Test” settings on your iPhone, which allows you to see many, many advanced network settings on your phone including cell site information and more.

… but hey, for those of us who aren’t hardcore cellphone geeks, this is news!

[EDIT: And here’s a list of standard GSM codes for call forwarding and the like which the iPhone ought to support; also check wikipedia!]

h/t: MobileOrchard!

UI Design Patterns

If you’ve got anything to do with designing iPhone interfaces — on paper or not — do not miss this post over at the new to us but worthwhile looking Flyosity blog about the advantages and disadvantages of different types of conventional iPhone application view organization

These three main interaction concepts correspond to three different types of View Controllers: Navigation Controllers, Tab Bar Controllers, Modal View Controllers and Table View Controllers respectfully. These are the building blocks for crafting iPhone applications.

and designing custom interfaces as well, with several paradigms of each type. Nothing overly surprising, but a nicely crafted overview, and the custom examples chosen are particularly interesting.

h/t: Daring Fireball!

App Store keywords

Just in case you missed the news so far, now you’re allowed to put up to 100 comma-separated characters of keywords (although the instructions claim 255) in your App Store listings — sign into iTunes Connect and you’ll see a new field in your application information screen:

keywords.png

You read our bit a couple days ago about seeding your description with keywords, yes? Well, time to start applying all your SEO-fu to a direct keyword selection now!

iPhone Stencil Kit

[EDIT: Discontinued.]

Now here’s something that we bet you didn’t see coming as an aid to your iPhone UI design: a stainless steel stencil. Yes, the kind that works with paper.

iphonestencil.jpg

Personally, we figure Interface Builder live design is the way to go when trying out interface ideas … but hey, there is a body of opinion out there that believes in paper prototyping, and if you’re one of them, this is for you, indeed. Besides, it just looks cool, doesn’t it now?

h/t: LinkedIn!

GUI Elements with Keynote

Now here’s a clever-sounding workflow for whipping together some reasonably attractive non-standard GUI elements for your iPhone project in short order; particularly useful for trolls, who as artists are really good programmers, if you get our drift.

Turns out that Keynote, which chances are fairly good you probably have on your machine even if you didn’t realize it as part of iWork, is very good at creating custom buttons and the like.

Then he recommends you just shimmy the shapes Keynote produces through the Acorn image editor, which apparently handles them quite gracefully — we wouldn’t know, so far we’ve found GraphicConverter the heartwarmingly geekiest of bitmap editors for us, but when we give this plan a whirl next time we want a funky button we’ll try out Acorn if GraphicConverter happens to not handle Keynote creations gracefully — et voilà, you have Xcode/IB-ready graphic files!

We also note from the comments that OmniGraffle is suggested for this kind of designer-challenged design as well, so there’s another option.

h/t: iPhoneFlow!

Sales reporting update

So you may recall that up until now we’ve been quite pleased with the daily email reports from AppFigures.com — but OH NOES! they’ve decided they actually want to make us pay for it now: $5 + $1.50 per app over two … per month.

Hmmm. While we suppose it wouldn’t actually bankrupt us, that is going to mount up, especially if you want to track various free, promotional, etc. versions as well as apps people are actually paying for. In addition, as well as reporting to people that we’re publishing on behalf of, there’s also the situation of being paid through royalties for things published by other people, in which we’d like to specify a daily reporting method … but insisting on a paid service is likely to cause unnecessary friction there. Very likely, in fact.

So we had a little wander around the web, and although we found a few new little tidbits to update our exhaustive sales tool list with, there still does not seem to be any tool other than AppFigures that will let you schedule daily email reports.

Sooooo, since we much prefer to keep our financial information and iTunes Connect passwords on our machine and out of the cloud anyways — it’s time to roll our own! And looks like the only two fairly full-featured (by which we mean, ‘scrapes iTunes Connect on its own’) starting points we see are both iPhone applications:

1. AppSales Mobile — on github — New BSD License

2. My App Sales — $15 for source — no commercial use

Not that we have any current plans to actually make any kind of commercial offering to compete with the existing solutions, but just in case the desire ever arises, we’ll start by checking out the AppSales Mobile code and see about scarfing what it does for a desktop daemon. If it turns out that everything we need isn’t there — although it looks like it is — then we’ll check out this other product.

Any other options to suggest, Dear Readers?

Snippet: NaturalDates

Snippet time again: here’s an NSDate category for you to easily provide “Today”, “Yesterday” etc. in Mail.app style, which is a friendly kind of thing to do when you have a date denoted kind of list:

… yes, we know, it’s just about impossible to actually read the code, we really must get around to finding the time to sort out a theme with a light background and none of this dumb wrapping. One of these days…

h/t: iPhoneSDK!