views:

146

answers:

1

So, I may have made a mistake in updating my application to iOS 4.0 by wiping my Xcode installation and only installing the 4.0 SDK (I can't even find SDK 3.1.3 in my backups, doh!). I have an app now that has been built with a base SDK of 4.0 and it says in iTunes it requires 4.0 but the only thing I added was the methods -applicationDidEnterBackgroundState and -applicationDidBecomeActive (basically just copied and pasted the save/load data code from -applicationWillTerminate and -viewDidLoad). Is it possible that I can rebuild the app with the iPhone OS Deployment Target set to 3.1.3 in the Build Settings and Apple will allow me to essentially downgrade my app? Should I put in those #If_Define statements that check for 4.0 so it will conditionally enable those 4.0 methods?

A: 

No, you shouldn't need to use #ifdef statements. You can call a method anything you want - the question is whether or not the UIApplication instance will call it :).

Also, your deployment settings will handle the iTunes issue, I believe. So, you should set it to 3.1.3 (or 3.0 unless specifically required, a lot of people I know didn't upgrade between the 3s because there were minimal features and many times it was essentially an anti-jailbreak release).

As for the code, I've handled this issue like this:

- (void) applicationWillTerminate:(UIApplication *)application
{
  // Just pass it on to the new iOS4 delegate
  NSLog(@"Application will terminate");
  [self applicationDidEnterBackground:application];
}

And for the foreground, I just have a "loader" method that is called both from application:didFinishLaunchingWithOptions: and applicationWillEnterForeground:.

Works well for my software on my 3G w/ 3.0 (I refuse to upgrade after seeing iOS4 on a 3G!) as well as my 3GS running iOS4.

phooze
Oh, ok... so basically when the App runs in 3.0 it will just ignore any -applicationDidEnterBackground calls... yes, I seem to remember that being one of the benefits of Objective-C
Robot-Scott