开发者

why device.multitaskingSupported not working on some devices?

开发者 https://www.devze.com 2023-03-15 03:26 出处:网络
chey I am working on a ipod and i wanted to make sure that the device supports multitasking for some features to ru开发者_JAVA百科n... is there any way? I tried with this -

chey I am working on a ipod and i wanted to make sure that the device supports multitasking for some features to ru开发者_JAVA百科n... is there any way? I tried with this -

   UIDevice* device = [UIDevice currentDevice];
   BOOL backgroundSupported = NO;
   backgroundSupported = device.multitaskingSupported;

but the above function not working properly its crashing on some devices... any idea?


Seems like you are using device.multitaskingSupported where it is not supported... You should check if multitaskingSupported is available on device or in OS before using ..

You should do something like this -

- (BOOL) isMultitaskingCapable
{
    UIDevice* device = [UIDevice currentDevice];
    BOOL backgroundSupported = NO;
    if ([device respondsToSelector:@selector(isMultitaskingSupported)])
        backgroundSupported = device.multitaskingSupported;

    return backgroundSupported;
}


See in the apple documentation of UIDevice.

@property(nonatomic,readonly,getter=isMultitaskingSupported) BOOL multitaskingSupported

Availability Available in iOS 4.0 and later.

So, multitaskingSupported is only available in iOS 4.0 and later not below (3.0 or earlier).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号