-1

presentViewController 未显示邮件模态视图控制器。我已从 presentmodalviewcontroller 更改为 presentViewController,但它没有给出任何错误,也没有显示 modalview。如何解决这个问题?

    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc]init];
    picker.mailComposeDelegate = self; 
    picker.navigationBar.tintColor = [UIColor colorWithHue:0.6 saturation:0.33 brightness:0.69 alpha:0];
    NSString *lObjstringPtr = (NSString *)nil;

    if(OPPORTUNITY_ENTITY_OBJECT_TYPE_CODE==m_cobjOwningGroup.m_cObjSelectedEntity.m_cObjectTypeCode) {
        lObjstringPtr = [lObjstringPtr stringByAppendingFormat:@" To Follow Up"];
        [picker setSubject:lObjstringPtr];
        lObjstringPtr = (NSString *)nil;
    } else 
        [picker setSubject:@""];

        [picker setMessageBody:m_cObjemailBodyStrPtr isHTML:NO];
        NSArray *toRecipients = [NSArray arrayWithObject:pEmailID];
        [picker setToRecipients:toRecipients];
        [self presentViewController:picker animated:YES completion:nil]; 
        [picker release];
4

1 回答 1

0

两件事,一件是针对这个案例的,一件是一般性的。

  1. 您似乎没有检查您的设备上是否设置了邮件。在您尝试显示邮件视图之前,您应该检查的返回值,[MFMailComposeViewController canSendMail]并且只显示控制器,如果它是YES
  2. 视图未显示的常见情况是控制器是nil. 在presentViewController:您可能想要检查(使用NSLog或使用调试器)picker不为零之前。
于 2013-03-20T11:53:10.470 回答