在我的应用程序中,MFMailComposeViewController工作正常,但创建MFMessageComposeViewController的新实例失败。MFMessageComposeViewController alloc返回无
下面是两个代码:
-(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];
}
它似乎很明显,一切都正确连接,因为电子邮件视图控制器正常工作。有没有我缺少的配置明智?
非常好,谢谢。我可能应该更清楚地认识到,使用模拟器出现问题显然没有SMS功能。 – Lee 2010-08-17 14:52:06
如果没有SIM卡,则应用程序退出。为什么?它只是给出了一个弹出消息“不存在SIM卡”。它发送一个SMS发送结果给委托方法。然后退出。有没有办法阻止它退出? – karim 2010-10-08 09:26:35
你检查了控制台的消息吗?它是否会崩溃或退出“正常”?有没有崩溃日志?附加调试器有帮助吗? – 2010-10-13 20:17:40