小编Lee*_*e 的帖子

MFMessageComposeViewController alloc返回nil

在我的应用程序中,MFMailComposeViewController工作正常,但创建MFMessageComposeViewController的新实例失败.

以下是两者的代码:

-( IBAction)sendSMS: (id)sender
{
 MFMessageComposeViewController *picker = [[[MFMessageComposeViewController alloc] init] autorelease];
 picker.messageComposeDelegate = self;

 NSArray *toRecipients = [NSArray arrayWithObject: cell.currentTitle ]; 

 picker.recipients = toRecipients;

 [self presentModalViewController:picker animated:YES];
}

-( IBAction)sendEmail: (id)sender
{
 MFMailComposeViewController *picker = [[[MFMailComposeViewController alloc] init] autorelease];
 picker.mailComposeDelegate = self;

 NSArray *toRecipients = [NSArray arrayWithObject: email.currentTitle ]; 

 [picker setToRecipients:toRecipients];

 [self presentModalViewController:picker animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

由于电子邮件视图控制器工作正常,所以一切都正确链接似乎很明显.是否有一些我错过的配置明智?

iphone objective-c ios4 mfmailcomposeviewcontroller

18
推荐指数
1
解决办法
1万
查看次数