2012-10-19 19 views
1

目前我正在iPhone應用程序工作,使用MFMessageComposeViewController來開發此應用程序,並且其工作正常。如何在iPhone設備中發送消息?

enter image description here

但我想,郵件撰寫屏幕不顯示在屏幕上,則該消息編程方式發送, 如何做到這一點?有可能的?請幫我

我嘗試這樣做:

MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease]; 
    if([MFMessageComposeViewController canSendText]) 
    { 
     controller.body = @"Hi"; 
     controller.recipients = [NSArray arrayWithObjects:@"12345678", @"87654321", nil]; 
     controller.messageComposeDelegate = self; 
     [self presentModalViewController:controller animated:YES]; 
    } 
+0

檢查這個帖子: http://stackoverflow.com/questions/10848/how-to-programmatically-send-sms-on-the-iphone – 2012-10-19 06:02:39

回答

1

我試着這樣做一次,但,但它不會被應用程序商店接受。蘋果公司不會讓你發送消息/電子郵件沒有用戶知道它。

+0

謝謝您replly – SampathKumar

1

您可以使用sms:[目標電話號碼] URL來打開短信應用程序,但是沒有關於如何預先填充短信正文的說明(請參閱Apple開發者論壇上的this post)。

+0

感謝您replu – SampathKumar

1

如果用戶不知道它,就不能使用消息框架發送消息。一種常見的解決方案是將消息詳細信息發送到服務器上運行的Web服務,並從服務器發送消息。只要你不想偷偷摸摸,我不認爲這樣做有什麼問題。

相關問題