Trifork Blog

iPhone OS 4.0

April 11th, 2010 by

This is just a quick blog post to share my excitement for the new iPhone OS firmware version 4.0, which was announced by Apple just a few days ago. Yesterday I installed the beta version of this new OS on my phone, only to find out that a few of the new features are not supported on iPhone 3G 🙁 Unfortunately, those features will be available only on iPhone 3GS. Nonetheless, I am very excited about all this new stuff and want to go over the most interesting features, both from a user’s and a developer’s perspective.

From a user’s perspective

I want to highlight a few of the new features I think are most interesting which come with the new iPhone OS 4.0.


I was always one of the people that believed that the iPhone doesn’t need multitasking at all. I was perfectly happy with the fact that an app can manually save it’s state on exit, and restore that same state when you start the app again, like nothing happened. A while ago I was using a phone that did support multitasking. It was the HTC Magic which was running on Google’s Android platform. I soon noticed the downsides of the ability to multitask. The battery runs out very quickly (even quicker than an iPhone’s battery) and the phone tends to get really sluggish when you have just a few apps running in the background.

The downsides of multitasking I just described were one of the reasons why Apple didn’t support multitasking in the first place. They wanted to make a phone that provided a great user experience which runs smoothly in every circumstance. And also they didn’t want the battery to die in just half a day. But now with OS 4.0, Apple includes multitasking. It’s implemented in a way which preserves battery life and performance! Sounds very promising, doesn’t it? Let’s see if it is too good to be true.

I ran OS 4.0 on the iPhone simulator which comes with the iPhone SDK to play around with this new functionality. Because, like I said, I can’t use the multitask feature on my iPhone 3G. Now I can only demonstrate what the user interface looks like on the simulator. I deployed a little iPhone app which I created a while ago for an existing website. This website was created by a friend of mine and is kind of like a forum with just one thread, used by a group of people that know each other in real life. The screenshots below show how you can easily switch between that app and a Safari web page, as an example. To switch you can double click the home button and the icons of all currently running apps slide into the screen. Quickly switch to one of the running apps by tapping it’s icon.

Screen shot Yert + running apps Screen shot Safari + running apps

The way they implemented this is once an app is put in the background, the state of that app freezes. Once you switch back to that app, the app instantly continues to run from the same state you left it in. This way the app doesn’t keep running in the background which would negatively affect battery consumption and performance. Of course, some apps still want to be able to do stuff while in the background. Apple provides those apps with a bunch of services they can utilize to be able to do their thing, while preserving battery life. Here are a few examples:

  • Playing music in the background. For example the Pandora Radio app (which I believe isn’t available outside of America unfortunately) is now able to continue to play music even when the app is not running. It’s just like what the iPod app already could do, so now that same technique is available for all music playing apps.
  • Voice over IP in the background. For example the Skype app can now receive calls while it’s in the background! This service is kind of similar to what the Phone app already could do. This is awesome because this was the main drawback of using Skype on iPhone. You really needed to have the app running to be able to receive phone calls. Once you quit the app, you could no longer receive phone calls. This service makes it possible so that’s exciting news!
  • Receive GPS data while in background. This still consumes some of the battery’s life but it allows for example TomTom, to continue giving the user directions, even when the user is switching to other apps. But since you always have the iPhone connected to a power adapter when using TomTom, the extra battery consumption of this service is no problem at all.

There are a few more services available like this, but the ones I described above are the ones I think are most interesting.

Setting backgrounds

Yes, Apple finally gave in, the support for displaying a background image behind your application icons. So now people that didn’t jailbreak their phones can enjoy a nice little picture in the background too 🙂 This feature is also only supported on iPhone 3GS. Why it isn’t on 3G? I have no clue at all.

Organizing apps with folders

Another new feature is the ability to create folders to organize your apps! Each folder can contain up to 12 apps. This is a feature that IS supported on my iPhone 3G so I made some screenshots without the need for the simulator this time.

Screen shot closed folders Screen shot open Music folder

Before OS 4.0 you could “only” install  a total of 180 apps on your phone, so now in theory if you would replace every icon with a folder and stuff it with apps, you could install a total of 2160 apps! Which is totally ridiculous if you would do that, but it IS possible now 😛

Game Center

Apple included a preview of Game Center in the OS 4.0 beta, which will not be in the first release of OS 4.0. It’s supposed to be available later this year for everyone to use. As far as I understand, Game Center is a way for all iPhone games to easily find other users to play with and to keep online score boards and stuff like that. You can even challenge other players who are not currently playing the game. They get a push notification with the challenge, and if the user accepts, the game starts. To me this whole thing sounds just like the iPhone’s version of the Playstation Network and XBOX Live, which I think is awesome 🙂

From a developer’s perspective

OS 4.0 also includes a lot of new API’s for developers to work with to make their apps even more awesome.

Local notifications

Since OS 3.0 we already have push notifications, which let a server send messages to your phone when certain events occur. Now, we also get local notifications. The main difference is that these doesn’t require a server. An app can now simply schedule a local notification to be displayed at a certain time. I think this is a really cool feature since you don’t always need a server to display notifications.

Calendar access

By using the new EventKit framework, apps can now access the user’s calendar. So apps can now get existing events from your calendar and add new events to it. This was always something I was missing, but now it’s here!

Quick Look

With the Quick Look framework, apps are now able to show a preview of certain files. For examples attachments to an e-mail, or files in your DropBox. The following file types are supported: iWork documents, Microsoft Office documents, RTF, PDF, images, text and CSV files.

Sending SMS messages

Previously you could send SMS messages only by leaving the app completely and go into the Messages app (this could be directly triggered from within the app). Now SMS messages can be sent without leaving the app by using the Message UI framework. You stay in the same app while typing the text message.

Block object

This actually isn’t a new framework, it’s a new language feature in Objective C! The developer documentation describes it best: “A block object is a mechanism for creating an ad hoc function body, something which in other languages is sometimes called a closure or lambda”. This can for example be used as a replacement for delegates or it can be used as callback functions.

An example to sort a NSString array using a block object:

NSArray *stringsArray = [NSArray arrayWithObjects:@"string 1", @"String 21", @"string 12", @"String 11", @"String 02", nil];
static NSStringCompareOptions comparisonOptions = NSCaseInsensitiveSearch | NSNumericSearch | NSWidthInsensitiveSearch | NSForcedOrderingSearch;
NSLocale *currentLocale = [NSLocale currentLocale];

NSComparator finderSortBlock = ^(id string1, id string2) {
    NSRange string1Range = NSMakeRange(0, [string1 length]);
    return [string1 compare:string2 options:comparisonOptions range:string1Range locale:currentLocale];
NSArray *finderSortArray = [stringsArray sortedArrayUsingComparator:finderSortBlock]);
NSLog(@"finderSortArray: %@", finderSortArray);

The NSComparator finderSortBlock is the block object in this example. It describes a function which can compare two strings with each other.

That’s all folks!

That’s all I wanted to share for now. I am very excited about all this new development. Let me know what you think by leaving a comment in the comment section below.

Comments are closed.