1
A
答えて
0
import
#import <MessageUI/MessageUI.h>
<MFMessageComposeViewControllerDelegate,MFMailComposeViewControllerDelegate>
-(void)send_SMS{
Class messageClass = (NSClassFromString(@"MFMessageComposeViewController"));
if (messageClass != nil) {
// Check whether the current device is configured for sending SMS messages
if ([messageClass canSendText]) {
[self displaySMSComposerSheet];
}
else {
// feedbackMsg.hidden = NO;
// feedbackMsg.text = @"Device not configured to send SMS.";
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Device not configured to send SMS." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Call",nil];
//[alert setTag:5];
[alert show];
}
}
else {
// feedbackMsg.hidden = NO;
// feedbackMsg.text = @"Device not configured to send SMS.";
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Device not configured to send SMS." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Call",nil];
//[alert setTag:5];
[alert show];
}
}
// Displays an SMS composition interface inside the application.
-(void)displaySMSComposerSheet
{
MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;
[email protected]"Testing";
picker.recipients = [NSArray arrayWithObject:@"12345678"];
[self presentModalViewController:picker animated:YES];
}
// Dismisses the message composition interface when users tap Cancel or Send. Proceeds to update the
// feedback message field with the result of the operation.
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller
didFinishWithResult:(MessageComposeResult)result {
feedbackMsg.hidden = NO;
// Notifies users about errors associated with the interface
switch (result)
{
case MessageComposeResultCancelled:{
//feedbackMsg.text = @"Result: SMS sending canceled";
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"SMS sending canceled" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
break;
case MessageComposeResultSent:{
//feedbackMsg.text = @"Result: SMS sent";
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"SMS sent" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
break;
case MessageComposeResultFailed:{
//feedbackMsg.text = @"Result: SMS sending failed";
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"SMS sending failed" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
break;
default:
{
//feedbackMsg.text = @"Result: SMS not sent";
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"SMS not sent" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
break;
}
[self dismissModalViewControllerAnimated:YES];
}
関連する問題
- 1. SMSを送受信する
- 2. IOS Custome SMS ComposerでSMSを送信
- 3. iphoneでプログラムでSMSを送信する
- 4. wp7 sms受信とSMSインターセプタを送信
- 5. SMSの受信時に返信SMSを送信するには?
- 6. 脱獄機でSMSをプログラムで送信
- 7. iOSのTwilioでSMSメッセージを送信
- 8. iOSでリモコンイベントをプログラムで送信する
- 9. データをSMS電話でAndroidに送信
- 10. ルビーでTCPデータを送受信する
- 11. アンドロイド仮想デバイスとの間でSMSを送受信する
- 12. ネイティブメッセージングアプリケーションなしでSMSを送受信する
- 13. Android - SMS/MMS経由でvCardを送受信する方法は?
- 14. gsmモデム経由でSMSを送受信する
- 15. アスタリスクsipでSMSを受信
- 16. SMSを受信する
- 17. SMSを受信するj2me
- 18. データの送信と受信
- 19. バッファクラスと送信/受信データ
- 20. 送信/受信奇妙データ
- 21. 送信済みSMSメッセージのAndroid放送受信機?
- 22. smsでアンドロイド(sendintent)がSMSを送信
- 23. アンドロイドRTP送受信プログラム
- 24. GenymotionでSMSを送信
- 25. Javaでsmsを送信
- 26. 送信SMSからデータを取得
- 27. 「自動SMS送信者」の作業方法 - SMSをバックグラウンドで送信する
- 28. スレッド1:プログラム受信信号 "SIGABRT" iOS
- 29. jspでSMSを送信する
- 30. AndroidでSMSを送信する