Let's Talk iPhone Event

I always love the last few months and weeks that build up to an iPhone/iPad announcement.  Though some of the rumors have turned into fact, most are just random, fabricated factoids that many MSM and bloggers push out there for the masses.  At the end of the day I can only presume that Apple doesn't pay those any attention except in the case of lost hardware.

However, I am not immune to reading a lot of these misleading articles. Granted I don't treat them as gospel there are a few things that I am very excited about.

First, is the official roll out of iCloud.  Having used the beta version the past few months I have been pleasantly surprised as it's convince and ease of use.  It is a huge win for the average consumer who has, up to this point, been reliant on iTunes and various other backup strategies to manage their content and media.

Second, is iTunes Match.  It has always been somewhat of a let down that users couldn't access all of their music from any of their devices.  The process is extremely easy and now you don't have to carry around a separate iDevice to hold your music catalog.

Third, wireless syncing.  I have a strong feeling that most IT administrators and children/grandchildren who have to provide tech support to their parents/grandparents will jump up and down over this.

Fourth, the API features with the new iOS have once again raised the bar for app developers.  Apple has listen to feedback from developers to make it easier for us to provide better functionality in our apps as well as more detailed customization options.  

*Bye-bye drawRect: category*

Fifth (possibly), Apple Assistant.  Rumor Alert! Could the headline "Let's Talk iPhone" really have a hidden meaning.  
Apple gave the masses the first decent implementation of multi-touch.  The communication mechanism that is inherit to all since birth.  Pointing, dragging, panning, zooming, swiping.  With the acquisition of Siri, there is no doubt that Apple has been putting a lot of effort in creating the near-perfect implementation of voice recognition for the masses.  On device voice processing via natural speech that is a native part of iOS.  If this is the case, then you will see a whole new generation of apps and a paradigm shift in how users, impaired or not, interface with these applications.

Apple...let's talk.

Upcoming to Universal iOS App on GitHub

In anticipation for the upcoming public release of iOS 4.2, I have updated my Universal iOS App project (iAd Branch).  The project will run on 3.2 and up with iAd support for iPhone and iPad (4.2 only for iPad).

I ran into some interesting hurdles while working on this update.  The first of which is that adding in iAd support for a project using a UISplitViewController SUCKS! #FAIL When iAds where first offered in the 4.0 iOS they came in two different size: 320 x 50 (ADBannerContentSizeIdentifier320x50) and 480 x 32 (ADBannerContentSizeIdentifier480x32) which served their purpose since you could use iAds only on the phone.  When iAd support was added for the iPad Apple was smart and deprecated those properties and added ADBannerContentSizeIdentifierPortrait and ADBannerContentSizeIdentifierLandscape, thus abstracting the dimensions that are available for any current and future devices.  This unification works great on the iPhone and iPad...except for when you implement UISplitViewController on the iPad.  The reason being that even though your root view or "detail" view controller are in landscape or portrait mode their widths aren't in the expected frame width for either choose of iAd. Thus you get an inaccurate display and you will an error in:

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error

stating that an ad has displayed but is being obscured. In order to get around this I had to add in some padding to readjust the 'y' coordinate for the tableview's frame (only when the ad appears).  Why the rotation, and only on the iPad, gets screwed up I am not sure at the moment.  I created a simple, iPad only project and got the same results so there might be a bug, but until I am able to verify, my "padding" works".

It is important that if you clone/run this project that you read the debug console for iad display errors.  These are relevant errors passed to the delegate method and don't have to do with my code.  You will notice in the video that ad fails to load the first round.  This is due to an error from Apple serving up the ad because inventory is not available. Second time is the charm.

*important - always implement delegates to handle failures

In the next few weeks I'll be adding a branch where the Universal app will have Tabbar support.

Creating a Universal iOS App Tutorial

Just when I thought I had a somewhat decent grasp on developing and deploying iOS apps Apple came out with the iPad and threw a whole new element in the mix when it comes to developing.  Thankfully, the iPad will allow iPhone apps to run on the device, but the user experience is definitely sub-par.  So what is the best approach to providing an native iPhone app and a native iPad app?  The first option is to duplicate your existing iPhone app code base and modify all your views and some of the controllers to take advantage of the features in the 3.2 SDK.  The problem with that is the massive DUPLICATION of code and to be honest it seems quite lazy.  I have seen lots of examples where developers use the idiom check for which device is being used, as well as, runtime checks for selectors in order to leverage the correct methods/classes for the given device.  While this is certainly a better approach then having two separate code bases with 90% of the same code you now have code that is sprinkled/littered with if/else checks.  Unfortunately, you are once again stuck with code that will be maintainable for long.  After reading the chapter on universal apps from the upcoming book from Pragmatic Programmers, iPad Programming, I found a much better design pattern of splitting out the app into Shared, iPhone and iPad resources, classes and delegates.

As a side note, due to the ever exponential growth of iOS device popularity developers are not going to have the bonus of just jumping straight into writing an app like we did when there was just the iPhone.  A lot more thought needs to be given to design patterns (especially regards to the quality of your MVC) and application flow.

In order to make life a little easier on myself since a few universal apps are coming in my near future I decided to create a basic "template" for a universal app.

Features
  • Compiled for 3.2 and 4.0
  • Utilizes navigation controller based app for iPhone device and SplitViewController for iPad
  • Shared "model" class and controller classes
  • Separate resources (classes/xibs) for the different devices

Comments and improvements are ALWAYS welcome.  One improvement that I know I want to make is having the "detail" controller from the SplitViewController to be a UINavigationController.