Iphone UIModalPresentation全屏显示通用应用程序中的错误

Iphone UIModalPresentation全屏显示通用应用程序中的错误,iphone,Iphone,我创建了通用应用程序,因为我使用UIModalPresentationFull在iPad中显示MFMailComposer表单,这有助于我在iPad的横向视图中显示MailComposer视图的全屏。当我在ipad模拟器中运行应用程序时,我工作得很好。如果我将其设置为iPhone simulator 3.0或3.1.3,它会显示错误,如“错误:'UIModalPresentationFullScreen'未声明(首次用于此函数)”当我对其进行注释并在iPhone simulator中运行时,它会

我创建了通用应用程序,因为我使用UIModalPresentationFull在iPad中显示MFMailComposer表单,这有助于我在iPad的横向视图中显示MailComposer视图的全屏。当我在ipad模拟器中运行应用程序时,我工作得很好。如果我将其设置为iPhone simulator 3.0或3.1.3,它会显示错误,如“错误:'UIModalPresentationFullScreen'未声明(首次用于此函数)”当我对其进行注释并在iPhone simulator中运行时,它会工作。该错误的解决方案是什么,或者,任何方法都会替换“UIModalPresentationFull”可以在ipad和iphone上使用吗

谢谢和问候
Venkat

UIModalPresentationFullScreen仅在3.2(及以上)SDK中可用,因此您无法使用低于该版本的SDK编译它

但是,对于一个通用应用程序,您不需要这样做——您根据要运行的最高SDK编译它,然后您必须在运行时检查您使用的方法/类是否可用。您可以在构建设置中进行设置:基本SDK应设置为您正在使用的最高SDK(对于iPad可能为3.2),而iPhone OS部署目标应设置为3.0-代码可以运行的最低SDK

每次使用仅限3.2位的代码时,您都应该这样做:

if ([controller respondsToSelector:@selector(setModalPresentationStyle:)])
    [controller setModalPresentationStyle:UIModalPresentationFullScreen];
然后,即使您已经针对3.2 SDK进行了编译,但当您在较低的SDK设备上运行它时,该方法将不会运行

我在一台仍然有3.0SDK的iphone上测试了这个。我不知道你会如何用更低的SDK在模拟器中进行测试

enter code here
使用条件编译块,我们可以隔离iPhone和iPad的进程

“#如果"IPHONE"操作系统"版本"允许的最大值>=30200”

“#endif”


请删除引号并使用if和else部分…(即)条件编译块

deanWombourne先生这里是我的代码,我不知道如何实现上述代码。“MFMailComposeViewController picker=[[MFMailComposeViewController alloc]init];picker.mailComposeDelegate=self;NSStringemailSubject=NSLocalizedString(@“email_subject”,@“”);[picker setSubject:emailSubject];NSString*emailBody=NSLocalizedString(@“email_body”,@“”);[picker setMessageBody:emailBody isHTML:YES];picker.modalPresentationStyle=UIModalPresentationFullScreen;[self-presentModalViewController:picker动画:是];picker.navigationBar.tintColor=UIColorFromRGB(0x003399);[picker release];很抱歉,我没有回复,我一直在度假!你让它工作了吗?
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    // The device is an iPad running iPhone 3.2 or later.
    if ([picker respondsToSelector:@selector(setModalPresentationStyle:)])
    {
        //picker.modalPresentationStyle = UIModalPresentationFullScreen;
        [picker setModalPresentationStyle:UIModalPresentationFullScreen];

    }
}