Iphone 错误:请求成员';多任务支持';在非结构或联盟中

Iphone 错误:请求成员';多任务支持';在非结构或联盟中,iphone,ios4,Iphone,Ios4,我试着在iPhoneSimulator 4.0上运行这段代码,并得到了那个错误 //#ifdef __IPHONE_4_0 UIDevice *device = [UIDevice currentDevice]; if ([device respondsToSelector:@selector(isMultitaskingSupported)] && device.multitaskingSupported) { } //#endif 以前有

我试着在iPhoneSimulator 4.0上运行这段代码,并得到了那个错误

//#ifdef __IPHONE_4_0
    UIDevice *device = [UIDevice currentDevice];
    if ([device respondsToSelector:@selector(isMultitaskingSupported)] && device.multitaskingSupported)
    {


    }
//#endif
以前有人用模拟器做过多任务处理吗?请帮帮我

非常感谢


你是为4.0 SDK编译的吗?在4.0 SDK之前,未定义属性
多任务支持
,因此编译器将失败。试一试

if ([device respondsToSelector:@selector(isMultitaskingSupported)] &&
    [device isMultitaskingSupported]) {
      ...
}

相反。

@KennyTM:error:请求在非结构或工会中的成员“多任务支持”我发现了问题。需要在目标属性而不是项目属性中将基本SDK更改为iPhone 4.0。