Thanks in advance.
Versions of iOS prior to 4.0 don't have this method, so you have to use respondsToSelector
to first check that the method is present prior to calling it.
if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)] && [[UIDevice currentDevice] isMultitaskingSupported]) {
// Device supports multi-tasking...
}
else {
// No such luck.
}
As such, whilst you're using the iPhone simulator 4.1, I'm guessing that you've set the iOS version to 3.2 (use the Version option on the Hardware menu to change this).
You can Add below mention methode yo your Project to check If device support multi threading before any action
- (BOOL) isMultitaskingSupported
{
BOOL result = NO;
UIDevice *device = [UIDevice currentDevice];
if (device != nil)
{
if ([device respondsToSelector:@selector(isMultitaskingSupported)] == YES)
{
#ifdef __IPHONE_4_0
#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0)
result = [device isMultitaskingSupported];
#endif
#endif
}
return(result);
}
}
This will return Bool i.e True in case device supports Multitasking
精彩评论