views:

227

answers:

1

I updated to the latest iOS 4 SDK, and updated my iPod touch to the latest OS fine. I built my application against 4.0, and it appears to use the multitasking functionality fine. However, when I run my application on my iPod touch, it does not appear to use multitasking.

How can I detect whether multitasking is supported on a device in code? Is there any way to work around this for unsupported devices?

+2  A: 

You can check whether the device is capable of multitasking like this:

UIDevice* device = [UIDevice currentDevice];
BOOL backgroundSupported = NO;
if ([device respondsToSelector:@selector(isMultitaskingSupported)])
   backgroundSupported = device.multitaskingSupported;
tob
thank you sir but i didn't get you . whither it is going to be use in the code
You asked how to detect whether your device supports multitasking. The above code does exactly that. After running this piece of code, `backgroundSupported` will be `YES` if your device supports multitasking, otherwise `NO`.
tob
I understand but where it is going to be use in the application code
Whereever you want to know if multitasking is available and behave differently.
tob
iPod does not support multitasking even if you've updated it to iOS4. Multitasking is only supported on iPhone 3GS and iPhone 4.
tob
I implement the code which you give me like this- (void)applicationDidEnterBackground:(UIApplication *)application { UIDevice* device = [UIDevice currentDevice]; BOOL backgroundSupported = NO; if ([device respondsToSelector:@selector(isMultitaskingSupported)]) backgroundSupported = device.multitaskingSupported;}but ipod doesn't workwhat i do now sir
See my comment above. The iPod does not support multitasking regardless whether you've installed iOS 4 or not. You will have to get an iPhone 3GS or an iPhone 4 to get multitasking.
tob
@tob - Actually, the third-generation iPod touch also supports multitasking as well, but it sounds like he has an older model.
Brad Larson