My delicious.com bookmarks for February 15th through February 26th

  • Tits and Apps – About most of the 'sexy' iPhone apps being pulled last weekend: "What developers see is that the App Store is a shaky foundation upon which to build a business. One day you’re prospering, the next day your app is gone. There are awesome iPhone OS apps that aren’t being built because developers don’t trust Apple not to yank the carpet out from underneath them."
  • Infer.NET – Seen at the BCS/IET Turing Lecture by Chris Bishop. Looks interesting.
  • Sources offer peek at Adobe Creative Suite 5 for Mac – PhotoShop CS5: what do you do to the app that has everything? Not a lot, visually at least…

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).

My delicious.com bookmarks for February 2nd through February 7th

My delicious.com bookmarks for January 27th through January 31st

  • Who Can Do Something About Those Blue Boxes? – "Used to be you could argue that Flash, whatever its merits, delivered content to the entire audience you cared about. That’s no longer true, and Adobe’s Flash penetration is shrinking with each iPhone OS device Apple sells."
  • Penguins, Peaks and Penny-Farthings: Nat Geo Covers 1959-2000 – "The National Geographic Society celebrates its 122nd anniversary on Jan. 27 … Though the early issues had rather drab academic looking covers, by 1959 they were consistently adorned with eye-cathing art and photos."
  • Verified by Visa bitchslapped by Cambridge researchers – "Secondary credit card security systems for online transactions such as Verified by Visa are all about shifting blame rather then curtailing fraud, Cambridge University security researchers argue." Or put another way: those annoying screens you get when you buy something online are not for your benefit.

My delicious.com bookmarks for November 16th through December 1st

  • The November Plan – Post now updated with my recent trip to Austria.
  • Apple’s Mistake – "How much of the goodwill Apple once had with programmers have they lost over the App Store? A third? Half? And that's just so far. The App Store is an ongoing karma leak."
  • The Daily Shoot – A great idea to help people (myself included!) to take more pictures. I think a lot of us have the will, just not the time or inspiration. Time is hard but inspiration just got a little easier.

My delicious.com bookmarks for November 6th through November 10th

  • News Corp to Offer Plaid Stamps! – "Giving Murdoch the benefit of the doubt, then, I’m guessing he simply doesn’t mean what he said. Perhaps he just wanted to sow a little confusion, get some publicity and maybe a concession or two from Google."
  • The night the Berlin Wall fell – "For me it was that rare occasion when a story was unqualified good news. After years watching the way communism was practised, I felt no need to mourn its collapse. Whatever came next had to be better." Twenty years since the fall of the Berlin wall.
  • OMG Ponies!!! (Aka Humanity: Epic Fail) – "The real world has failed us. It has concentrated on local simplicity, leading to global complexity. It's easy to organise a meeting if everyone is in the same time zone – but once you get different continents involved, invariably people get confused. It's easy to get writing to work uniformly left to right or uniformly right to left – but if you've got a mixture, it becomes really hard to keep track of. The diversity which makes humanity such an interesting species is the curse of computing."