-1

I am writing an Iphone App and i want the user to be able to send SMS messages directly from the app itself so when the form button is clicked in the app both pre defined mobile number and body of text are passed to the iphones compose sms screen so then all the user needs to do is press the send sms button

i have spent several days searching web and trying different solutions non of which I have been abel to get to work

any assistance pointing me to a step by step guide to the code needed would be appreciated

user2134512
  • 11
  • 2
  • 8
  • Days of searching didn't reveal `MFMessageComposeViewController`? – rmaddy Nov 19 '13 at 01:18
  • have you read http://stackoverflow.com/questions/10848/how-to-programmatically-send-sms-on-the-iphone?rq=1 – chancyWu Nov 19 '13 at 01:19
  • Hi I am a newby to iphone app dev. the code works, however my app managers a users mobile device. The app user can send update commands to the device via sms Each device will have a series of different commands each with its own form page where the user selects the various parameters eg start time stop time; reporting frequency etc etc – user2134512 Nov 19 '13 at 02:26
  • I am a newby to iphone app dev. the code works, however my app managers a users mobile device. The app user can send update commands to the device via sms Each device will have a series of different commands each with its own form page where the user selects the various parameters eg start time stop time; reporting frequency etc etc The values selected in the form need to be added into specifc string syntax and then that string needs to be send to the compose sms screen along with the mobile number of the given device any guidance on how best to tweak the code to achieve the above please – user2134512 Nov 19 '13 at 02:33

2 Answers2

1

It sounds like all you need to do is add a "MFMessageComposeViewController" object to your app and set some of the fields (e.g. the recipients, the body, etc.).

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • Thanks i have downloaded this. Yes it works however i need to customise it so that the phone number and the body of the message is created dynamically – user2134512 Nov 19 '13 at 02:16
1

As other people have said, the MFMessageComposeViewController class is used when composing text messages for apps. This class can

"configure the initial recipients and body of the message, if desired, and to configure a delegate object to respond to the final result of the user’s action-whether they choose to cancel or send the message"

What this means is you can configure the class to respond to whether the user wants to send the message, or cancel it.

Before you use this class, however, you must call the canSendText class to make the sure the device can send a text or not. If the canSendText class returns a value of NO, then do not show the message composition view. That way, your app doesn't try sending a text with a device that cannot send one (i.e. iPod)

According to the documentation by apple, you must make sure that

" If neither iMessage nor SMS/MMS (Short Message Service/Multimedia Messaging Service) delivery is available, you can notify the user or simply disable the messaging features in your app."

Hopefully this helped you.

Domecraft
  • 1,645
  • 15
  • 26