tags:

views:

177

answers:

3

Hi all,

I am creating an application that sends and SMS while taping on a button. To implement this functionality I installed the iPhone SDK 4. Since it supports in app SMS. But when I tap on my button to send SMS the MessageUI view controller is displayed along with my custom SMS body. I dont want to display this screen, I just need to send the SMS in the background with out displaying the SMS screen to the User.

Can any one help me in solving this.? Please help needed.

Thanks and Regards, Shibin

A: 

According to the official Class Reference provided by Apple, the composing message will always come up so that the user can confirm the message.

Raphael Caixeta
Thanks Raphael, Is there any other way to hide the view controller form the code?
Shibin Moideen
A: 

No, you cannot do that. There is a reason for that MessageUI controller showing - it's to confirm with the user that indeed the SMS is sent with her knowledge and understanding.

Franci Penov
+2  A: 

I'm pretty sure there's no way to do this. Apple wants the user to confirm an SMS send for at least a couple of reasons:

  • SMS costs the user money to send
  • If your app could send without confirmation, you could spam contacts from the user's address book, or worse, give them a link to a phishing site that they trust because the text came from a trusted source

Why do you care if the user confirms the SMS or not? As soon as they tap "Send", the MessageUI view controller is dismissed and the user is back in your app's screen.

The only alternative I can think if is to send an NSHTTPURLRequest to a web service that provides an SMS gateway. That you could certainly do in the background, though likely you (the developer, not the user) would incur the cost of sending the messages, and the sender would not appear to be the user.

chrispix