在我的應用程序中,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