Code check for multitasking capability

Discussion in 'iOS Programming' started by cnstoll, Dec 28, 2010.

  1. cnstoll macrumors 6502

    Joined:
    Aug 29, 2010
    #1
    So I'm about done working on an app update that will track a user's location in the background. Everything works great, of course, on phones and OS's that have that capability.

    For those that don't I have implemented some alternate functionality. But I need to check for whether or not I should switch to that.

    Initially I used two checks to determine this. I checked the system version to see whether or not it was >= "4.0", and then I also checked if location services were available (example: if a user disabled location services, it would respect that).

    I thought this would work until I remembered a specific detail: the iPhone 3G can run iOS 4...but doesn't support multitasking.

    So basically I need a new way to check for that condition. I don't want to put a hardware requirement in the info.plist file, because the app will run just fun without that on the 3G. What i'd like to be able to do is just check for something like "canMultitask" if something like that exists. Thanks.
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    Nothing like that exists.

    Are you certain that that there is a device running an OS >= 3.2 that can't multitask?
     
  3. yaniv92648 macrumors member

    Joined:
    Oct 26, 2009
    #3
    It exists.

    UIDevice has a boolean property multitaskingSupported.
    u don't need 2 check "if OS>=4.0..."
    u'r check is:
    UIDevice *currentDevice = [UIDevice currentDevice];
    if ([currentDevice respondsToSelector:mad:selector(isMultitaskingSupported)]) {
    // iOS >= 4.0 because the property multitaskingSupported exists
    if ([currentDevice isMultitaskingSupported]) {
    // Multitasking is supported!
    }
    }
     
  4. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    Looks like my info is out of date. At any rate multitasking is also available on 3.2.
     
  5. fishkorp macrumors 68020

    fishkorp

    Joined:
    Apr 10, 2006
    Location:
    Ellicott City, MD
    #5
    No it isn't, 4.2 was the first iPad OS to support multitasking, 4.0 was the first iPhone/iPod Touch OS to support it. 3.x does not have any multitasking support. And there are devices running iOS > 4.0 that can't multitask, the iPhone 3G, for example.
     
  6. jclardy macrumors 68040

    jclardy

    Joined:
    Oct 6, 2008
    #6
    Yeah, iPhone 3G and iPod Touch 2nd Gen can not multitask. iPhone and iPod Touch 1st gen don't have 4.x so they are left out of multitasking as well.
     

Share This Page