开发者

Warning: 'UIDevice' may not respond to '-isMultitaskingSupported'

开发者 https://www.devze.com 2023-02-18 04:52 出处:网络
I am working with n开发者_如何学Cew FBConnect for iPhone.But I have followed the steps given.. but when i build it shows me this warning \"Warning: \'UIDevice\' may not respond to \'-isMultitaskingSu

I am working with n开发者_如何学Cew FBConnect for iPhone. But I have followed the steps given.. but when i build it shows me this warning "Warning: 'UIDevice' may not respond to '-isMultitaskingSupported'" and the app crashes. I am using iphone simulator 4.1 and still it is showing me this warning. If anyone can help me out with this it will be great.

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

0

精彩评论

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