Apple Tech Talk

I was lucky enough to get an invite to the Apple 4k Tech Talk in London a couple of weeks ago. It was a worth while trip to the big smoke just for some of the snippets of information your get from some of the talks. Sometimes it doesn’t matter how many forums or blogs you read, how many articles or books you scour through, it takes someone talking to make something make sense.

I didn’t take copious notes like many other people did; there were a large number of people sat there typing in to their Mac Books, almost verbatim anything said!

Anyway, here are a few items I scribbled down that may be of interest.

The first two sessions I took were “Effective iPhone App Development” by Lawrence Coopet.

Data Storage
1. When storing config/session states, be careful about writing lots of objects into a dictionary as individual items. Create a session object and write that instead and don’t just write everything to NSUserDefaults.
2. Think about where you store this data… Archive and implement NSCoding and Data Recovery.
3. Use SQLite
4. Use CoreData
5. Store sensitive data in the KeyChain. This has the benefit of being able to share between projects – company data – application data.

When Caching data, make sure you place it in the correct place and never hard code your paths to this data.
All the paths are stored in NSPathUtilities.

NSTemporaryDirectory – this will always be cleared and will never be backed up.
NSCacheDirectory – this is saved, can be cleared, but will never be backed up.
NSDocumentsDirectory – never cleared, always backed up.

Choosing the right place for your data will determine how much iTunes has to backup when syncing your device.

Targetting iPhone OS
1. You should ALWAYS set your Base SDK to the most current OS version – ie. currently 3.1.2 – regardless of which OS you are considering deploying to.
2. Set you Deployment Target to the minimum OS you want your app to run on.
3. You should check for presence of OS features in your code. eg use NSClassFromString and respondsToSelector. However do this at the start of your app and set flags accordingly so that you are not taking speed hits during normal app operation. checking straight global C functions is very quick.
eg if ( UISaveVideoAtPathToSavedPhotoAlbum )

Application Flow
1. Stay focused!
2. The best system is generally – List View – Info View – Detail View. Allow the user to choose to drill down on data rather than forcing too much information on them in one go.
3. Always use the 1 screen 1 controller model.
4. Make sure you are not hardcoding references back to other objects in your application. Using the Model Controller View model your controller talks back to your model but your model should never talk directly to your controller. Your controller talks to you view but your view should never talk back to your controller. And you should never every have your view talk directly to your model. If parent communication needs to take place, then implement delegates. This way you can avoid App specific communication paths.
5. Use Delegates
6. Use Notifications through NSNotificationCentre

Memory Management
1. Make use of the measurement tools regularly – checking for leaks and generally memory usage.
2. Under Snow Leopard make use of XCode Static Analysis – it’s a fantastic tool. (BTW: It really is!)
3. Use the 1 controller 1 nib model.

Application Life Cycle
Compatibility
1. Prefix your classnames with your own token to avoid namespace collisions. eg UI, NS etc…
2. Avoid underscores at the start of method names – these are reserved to Apple.

Proper Code Paths
1. Follow correct code paths. eg. You implement drawRect and call setNeedsDisplay. NEVER call drawRect.

Interruptions
Make sure you handle applicationWillResignActive, applicationDidResumeActive, and applicationWillTerminate.

Concurrency
1. Make sure you use the Async API for Networking and Reachability.
2. Use NSTimer – don’t sit around in threads counting down!
3. Use NSOperation and NSOperationQue. Subclass NSOperation and override main.
4. Keep object access confined to one thread.
5. Design out the need to use locking/signalling/syncing
6. Avoid performSelectorInBackground and detachNewThreadSelector – if you are using these then you are doing it wrong. Use NSOperation.

Related Posts:

The Shawshank Redemption

While I was in London last week for the Apple Tech Talk, I decided to go watch The Shawshank Redemption at the Wyndham Theatre.

Most of you will be aware of the Film by Frank Darabont. Some of you may even be aware that it is based on the short story, Rita Hayworth and the Shawshank Redemption, by Stephen King.

I love the short story and I love the film. So when I noticed the other day that there was a play on in London, and that it was only running until the end of November, then I figured I should go watch it while I had the opportunity of being up there.

Firstly, I enjoyed watching it. It wasn’t great, it was ok.
I wonder if I am just not attuned to theatre. I don’t mind musical theatre, I get that, but the difference between plays and films seems to be vast. In this case, everything seems to be said in a shout.

The play is apparently based on the book and not the film – plenty of copyright issues here I guess. The problem is that Frank Darabont did a magnificent job of adapting the book, that it was always going to be hard to stray away from that. So the first think the writers did to differentiate the play from the film was to go back to the original source and have Red as a red-haired white man of Irish ethnicity – right? Wrong! Red is a Morgan Freeman wannabe… and it doesn’t work. His voice is gravelly, and fast, and loud. Morgan Freeman is controlled, slow, and soothing. I can’t read the book anymore without hearing Morgan Freeman narrating for me.

The version of Red’s voice-over, that makes the hairs stand up when delivered in the film…

There’s a con like me in every prison
in America, I guess. I’m the guy who
can get it for you. Cigarettes, a
bag of reefer if you’re partial, a
bottle of brandy to celebrate your
kid’s high school graduation. Damn
near anything, within reason.

In the play, this is the opening lines… rushed, shouted, gravelly, and disappointing…

All in all my concerns with the play were that even though the writers were apparently trying to steer clear of the film, they kept coming back to it. Many of the characters seemed liked they were poor versions of the film characters. In fact Tommy was almost identical that I wondered if they had just lifted the original actor.

In the film many of the characters we amalgamation of multiple characters – Brooks and The Warden in particular. In the play – yep you guessed it – amalgamations. Warden Norton – looked the same, if a little more portly!

I hated Andy Dufresne in the play ( Kevin Anderson). He’s cocky, too forward, almost having a controlled route through his time at the shank. But he still has this kind of Tim Robbins look-a-like thing going on.

So in the end, the play can’t make it’s mind up – be the film, be the book, or be neither. There are some very odd changes and additions that had no earthly right being there.
To be honest, I think the play is really cashing in on the film and not a decent theatrical version of the book. The writers have tried to avoid the obvious copyright issues without dropping things that their audience of film fans might take issues with. I mean, the whole thing starts with the name right? Rita Hayworth and The Shawshank Redemption

I think my favourite part was when the cast sing as Tommy is hanging in his cell… that was a wonderful moment, and almost worth the entrance fee alone.

Related Posts:

Artist Required

I really do need to find an artist to help me work on iPhone games!!

Please apply….

Related Posts:

Deadman Hill

I have a particular affinity with Deadman Hill. Anyway, Darren managed to find some information about it recently…

Deadman Hill
This is a stretch of the B3078 along a ridge from Godshill The most likely origin of the name is that a gibbet was situated at one time near the junction with the Redlynch road but a more colourful local story tells how in the mid-eighteenth century a smuggler named David Smith, in return for the promise of a free pardon, betrayed his associates including the infamous Captain Diamond. But not all were apprehended and Smith was waylaid near Studley Head by some of Diamond’s crew who had evaded capture. He was dragged down into the valley east of Cunninger Bottom, now known as Deadman Bottom, where his tongue was cut out, he was cruelly beaten and finally hanged from a tree.

Original text taken from New Forest Walks…

Related Posts:

  • No Related Posts

Dirty Harry Potter / Harry Callahan and the Deathly Hallows.

Lord VoldemortFor those who have not read The Deathly Hallows and are still intending to do so, then you might want to look away now as this may contain spoilers.

I’ve just finished re-reading Harry Potter. In fact I’ve been reading the series to Rebekah over the last year. Anyway, there is a part toward the end of The Deathly Hallows, where Harry is squaring up to Voldemort, and Harry starts to question Voldemort’s assumptions on the true ownership of the Elder Wand, that in my head sounded very different to the words that were actually on the page.

This is what I heard…

I know what you’re thinking. “Did he take rightful possession of the wand?” Well, to tell you the truth, in all this excitement I kind of lost track myself. So it all comes down to this, doesn’t it. Does the wand in your hand know that its last master was disarmed? Because if it does… I am the true master of the wand. And being as that is an Elder Wand: the most dangerous wand in the world, and is able to perform feats of magic that would normally be considered impossible, you’ve got to ask yourself one question: Do I feel lucky? Well, do ya, punk?


Harry Callahan

Related Posts:

%d bloggers like this: