Category Archives: Software

Software that I’ve written (or at least started writing).

www.cut 3.0

I’m very pleased to announce the new version of www.cut, a major release including an almost complete rewrite of all the UI code and a bunch of stuff under the hood. You don’t care about that, but it does bring you iPad support, the ability to lengthen already shortened URLs and the ability to sync your settings between devices using iCloud.

The iCloud bit, as with lots of stuff under the hood, means that it will only work on devices that run iOS5.

On the “business” side, www.cut is no longer free. It is now a “tier one” app, that means 99 cents, 69 pence or your local equivalent.

The reason for this change is two-fold: advertising, despite what you may have heard, is not a massive money-spinner unless you have millions of users. www.cut, you won’t be surprised to hear, has nowhere near that. Secondly, and more importantly in some ways, I just don’t like adverts. I almost always pay for apps in preference to using an ad supported version. I think the app is better without them.

With the change, I have tried to be as fair as I can. All existing users will get the upgrade for free, including those who only have the free version. I thought it better to be generous to early adopters that screw over the people who actually upgraded.

All New!

This week I’ve released updates to all three of my iPhone and iPad apps.

Yummy and Yummy Browser, my Delicious.com client, see the release of a big update: version 2.6.0. It includes a completely new bookmark viewing and editing screen, a new bookmark list view, updates to help syncing reliability and lots of smaller tweaks and updates. It’s the biggest gap between any two major releases but I think is a good one.

The www.cut update is much smaller, but includes the new Facebook API (looks the same!) and some minor aesthetic tweaks.

Hidden, and not mentioned in the release notes for any of the apps, is a crash reporter. Apple do push crash logs into their developer interface, but they do seem to skip some and it only ever happens when users sync their phones to iTunes — something that people seem to be doing less and less. I’ve seen reviews and support mails from people mentioning crashes but not seen the crash reports — which makes it really difficult to diagnose a problem. Hopefully you’ll never see it, but now they’ll prompt you to send the log directly to me after a crash.

However, even with that it’s still worth pinging me a support email if you see something amiss. Firstly, if it doesn’t crash I still won’t see it. And, secondly, the crash reports come without any context. Seeing which line of code is causing a problem is very useful but without knowing how you get there it can be very difficult to correctly diagnose and fix a problem.

Translations

www.cut Icon
One of the nice things about Apple’s App Store for iOS devices is that it’s available in every country that has the iPhone. One of the unfortunate things is that the people in most of those countries don’t speak English as a first language and I, as a typical Englishman, know no other languages.

Then I heard about GetLocalization (whose name needs localising!), a site which allows you to “crowd-source” translations. I honestly don’t know if it will work but I thought it was a good idea and something worth trying and supporting.

To that end I have uploaded the text used in www.cut and added the languages that I think there would be the most benefit in having. I would be happy if people added others, especially if the suggestion came with some translations!

My guess is that I will need to change some of the text in the application itself. For example, one block looks like this: “%1$i character%2$@ remaining.” When viewed on the iPhone looks like either “100 characters remaining” or “1 character remaining” but I’m sure that form of pluralisation doesn’t work in most languages. Changing it is not a problem but I will need suggestions as to what the “generic” version should be. Or do I need two versions, one for singular and one for plural?

So far I have only added www.cut and I’m classifying it as an experiment, though if it works well I will likely use the same method for Yummy.

Thanks for your help.

www.cut 2.0

A new version of my handy URL shortening app for iPhone and iPod touch has just hit Apple’s App Store. Please go and download it — it’s free!

www.cut main screen

I’ve added to the services that were supported in the previous version and now www.cut supports nine shortening services:

Also new in version 2.0 is a “URL Scheme.” This is a technical name for something that’s very useful. Picture the scene: you’re in Safari and you want to send the current URL to www.cut. Previously you had to copy the URL to the clipboard and manually launch it. Now, all you need to do is add “wwwcut:” to the beginning of the URL and www.cut launches automatically.

For example, if you’re looking at “http://www.apple.com/”, you would edit the URL to be “wwwcut:http://www.apple.com/” and press “go.”

When I use www.cut, most of the time I’m going to send a link to Twitter or Facebook. So in this new version there is the option to do just that within www.cut. It’s available as an in-app-purchase and also removes the adverts.

Another change you might see is if you enter something that looks like a URL but, technically, isn’t one, www.cut will suggest a correction. Another example, say you enter “www.apple.com”. I know that’s what they put on the TV and posters, but it’s not really a URL. www.cut will ask if you really meant “http://www.apple.com”.

Unfortunately, URL shortening is a tough business and a couple of the services that were available in version 1.0 are no longer operating. This means that you can no longer use In the 2.0 release, tr.im or cli.gs. If you upgrade, www.cut will switch you back to using is.gd, but you can easily switch.

Giving Back

A few years ago I was very much “into” the whole open source movement. I read LWN (still do, actually). I bought a copy of The Cathedral and the Bazaar.

But one thing I never really did was contribute to open source projects. I never really had much need. They largely did what I wanted and when they didn’t, well, the modifications were too big to consider attempting in my spare time.

And now I have a couple of applications in Apple’s App Store. I get the impression that a lot of apps you see there these days are mainly collections of open source code bundled together with some glue code and some new graphics. I know it sounds bad when you phrase it like that, but I don’t mean it that way. When you’re coding to a deadline and to cost this is a perfectly valid way of doing things.

But neither Yummy nor www.cut are like that. They are almost entirely my own code. Why? Two main reasons.

The first is historical: Yummy was initially developed when the now infamous NDA was in place. Developers couldn’t share code even if they wanted to.

Secondly, I like to minimise external dependencies. The iOS platform changes fast enough as it is without having to wait for other developers to update code as well. Of course, open source means that I could fix it myself but that probably means looking at code I’m not completely familiar with and that takes time. The desire to remove third party code led me to remove AdMob in Yummy Browser and www.cut and replace with Apple’s iAd, even knowing that the fill rate was very low1.

Ultimately, however, there’s too much great code out there to avoid it altogether. The current, shipping version of Yummy has two open source components and I have just released a (tiny) third one.

First is the Facebook Connect SDK. I have not made any modifications to this.

Second is InAppSettingsKit. This some software that duplicates the Settings screen and allows them to be included within the app as well as in the Settings.app. I made some minor fixes so that it works on the iPad (independently fixed and pushed upstream) and I added a “Log in to Facebook” cell. I’m not sure how common a requirement this is likely to be, so I’ve not pushed it back to the maintainers but I have made it available in a separate branch:

InAppSettingsKit

Third is something that should really be included in iOS itself. Apple’s guidelines say that when your app is sent into the background it should close any menus that are open. In “iPhone Speak” these are called UIAlertView (dialog in the middle of the screen) and UIActionSheet (menu from the bottom of the screen).

In addition, the iPad had a further requirement: there should be only one menu open at any given time.

I created UIViewAutoDismiss to help:

UIViewAutoDismiss

This code is inspired by a question and answer on Stackoverflow.

  1. Early indications are that, even with the lower fill rate, income is not vastly different, and this is with only two countries active at the moment with iAds. []

iPhone Dev: Saving State

I see every now and again that Apple needs to make it easier to allow developers to save the state of their application so that they open up exactly as they were when they were shut down.

Obviously I’m all for Apple making my life easy, but that’s not going to happen for a while yet so I thought I’d share how I implemented it in Yummy.

The key is this simple protocol:


@protocol SaveState
- (NSData*) saveState;
- (id) initWithSaveState:(NSData*)data;
@end

This is what I have in my applicationWillTerminate: method:


NSMutableArray* vcList = [NSMutableArray arrayWithCapacity:3];
for (UIViewController* vc in self.navigationController.viewControllers) {
    // Classes that don't implement the SaveState protocol will be ignored
    if ([vc conformsToProtocol:@protocol(SaveState)]) {
        NSArray* state = [NSArray arrayWithObjects:NSStringFromClass([vc class]),
                                                                     [(UIViewController*)vc saveState],
                                                                     nil];
        [vcList addObject:state];
    }
}

This is in the applicationDidFinishLaunching::


for (NSArray* screen in screenList) {
    UIViewController* next =
                [[NSClassFromString([screen objectAtIndex:0]) alloc]
                                   initWithSaveState:([screen count] == 2) ?
                                   [screen objectAtIndex:1] : nil];
    if (next != nil) {
        [[self navigationController] pushViewController:next animated:NO];
        [next release];
    }
}

So a simple example, for a view controller that needed to be remembered but didn’t need to store any extra state, would be:


- (NSData*) saveState {
    return nil;
}
- (id) initWithSaveState:(NSData*)data {
    return [self init];
}

But you can initialise each view controller with anything that can be converted into an NSData. (I picked NSData rather than, say, id because an NSData can always be serialised. Made sense to make that assumption.)

One weakness is that it doesn’t cope with the situation where a modal view is on top but that should be pretty easy to implement if it’s important (it generally isn’t in Yummy).