There are so much new features and possibilities that I couldn’t decide what to taste first and decided to continue everyday work. Later watching forums comments I see that the first thing everyone wants to do is to update an app by supporting 4.0, but surely it have to run on previous version also, 3.0-3.1. The right way is to open project settings and set:
- Base SDK – iPhone Device 4.0
- iPhone OS Deployment Target – iPhone OS 3.0
After recompiling it’ll turn to background properly, but still work on 3.0+ versions.
The second thing is the multitasking, of course.
There are two new UIApplicationDelegate’s methods for that. One when application was turned in to the background by pressing Home Button and one when turned out by pressing an icon on the spring board. As an example of background in/out workaround I provide using of Google Analytics, which is actually needed to be stopped and started:
- (void)applicationDidEnterBackground:(UIApplication *)application{
[[GANTracker sharedTracker] stopTracker];} -
(void)applicationWillEnterForeground:(UIApplication *)application{
[[GANTracker sharedTracker] startTrackerWithAccountID:@”xx-xxxxxxxxxxx
”
dispatchPeriod:20 delegate:nil]; [[GANTracker sharedTracker]
trackPageview:@”/” withError:nil];
// you could animate splash screen there}
If you’ve not read about what background is for then try this and this. It was discussed earlier the release.
Apple developer documentation for background execution.
The last I couldn’t get if it’s necessary to show splash screen when an app is coming back to foreground. It’s blinking for a moment each time
Since having an animated Default.png I just copy animating piece of code to “applicationWillEnterForeground” and it’s become better. But it’s not a common solution. See what Apple says about the Default.png in HIG (updated 2010-06-03):
To enhance the user’s experience at application launch, you must provide at least one launch image. A launch image looks very similar to the first screen your application displays. iPhone OS displays this image instantly when the user starts your application. As soon as it’s ready for use, your application displays its first screen, replacing the launch placeholder image.
Supply a launch image to improve user experience; avoid using it as an opportunity to provide:
■An “application entry experience,” such as a splash screen
■An About window
■Branding elements, unless they are a static part of your application’s first screen
Because users are likely to switch among applications frequently, you should make every effort to cut launch time to a minimum, and you should design a launch image that downplays the experience rather than drawing attention to it.
Design a launch image that is identical to the first screen of the application, except for:
■Text. The launch image is static, so any text you display in it will not be localized.
■UI elements that might change. Avoid including elements that might look different when the application finishes launching, so that users don’t experience a flash between the launch image and the first application screen.
Obviously there is no suggested solution yet. The problem is about foregrounding app may appear from any view, it’s not first main view as it’s used to be. So it seems better to use some branded image as a splash screen instead part of a UI. Or don’t use splash at all. It could also be a solution if we can set to ignore a splash when app is launched from background. Anyway not a big deal.
Other
The other things I mentioned at this time is the iOS simulator was updated. Now it has all three devices: iPad, iPhone, iPhone 4. The last has a camera simulator, but it does not work as you could suggest, it’s just a gap. iPhone simulators have “iAd tester” and “Game Center” for a sandbox. Pretty cool.
One more option is TV Out. It’ll be useful for our great apps presentations. It probably could help to record app demos with a better quality.
Have a nice learning.
Remember Apple provides free videos from WWDC 2010 this year. I’m sure everybody will find useful stuff for your self.
UPD:
I think we should remember a timedate of ‘applicationDidEnterBackground’ for better analytics tracking. And when ‘applicationWillEnterForeground’ try to decide if it’s clear run or run from background. I use 120 seconds time difference and two url names for tracking like that:
- (void) startGoogleAnalytics{ [[GANTracker sharedTracker]
startTrackerWithAccountID:@"XX-xxxxxxx-xx"
dispatchPeriod:20 delegate:nil]; if (lastBackground)
{ if ([[NSDate date] timeIntervalSinceDate:lastBackground] > 120)
[[GANTracker sharedTracker] trackPageview:@"/" withError:nil];
else [[GANTracker sharedTracker] trackPageview:@"/foreground" withError:nil];
[lastBackground release], lastBackground = nil; } else
[[GANTracker sharedTracker] trackPageview:@"/" withError:nil];}



