I am working on sending SMS demo. I want to send how to send the SMS and how to set the delegate to MessageComposeViewController. and in order to send the message we have below line
[self presentViewController:messageController animated:NO completion:nil];
This line will present the MessageComposeView on screen with SEND button. And Once we click on send button it sends the message. What I want is to send the message directly without presenting this MessageController on screen. Please help how can I do this.
In this related question, Apple has restrictions in place on being able to send a SMS message without the user clicking the SEND button.
Apple really wants the user to be in control of the SMS functionality of their phone. Otherwise all sorts of data could be flying off some random app (e.g. spamming your contacts with "try this app out!", which would not be very friendly nor very nice).
One of the answers in this question does have a potential non-MFMessageComposeViewController solution, however I have a feeling that if Apple catches you doing this they might deny your app from being approved for the app store.
You could send the message using some webservice on the internet. http://client.suresms.com/ProjectInfo.aspx?Info=3 or www.clickatell.com. They have bunches of API for sending messages.
In SureSMS simply create an account and make a http request to
http://suresms.com/Script/GlobalSendSMS.aspx?login=[youraccountnumber]&password=[yourpassword]&to=[phonenumber]&Text=Hallo.
Remember to URL encode the message text and use countrycodes. Thats it.
You have to present MessageComposeViewController.It's not possible to send without presenting it.
MFMessageComposeViewController has delegate method while delete/send/save. which only perform while we present it.
(void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
You can't do it without MFMessageComposeViewController. Apple won't allow to send SMS without user interaction.
As per document
You must not modify the view hierarchy presented by this view
controller. You can, however, customize the appearance of the
interface using the UIAppearance protocol.
I've alternate solution of this, Alternative way can be Using web service API. Create a web service at server side that send a message to specific number(s) that accept numbers as parameters with request.(according to your requirement)
As using Web server or external sms provider can do it.
It is NOT possible . Apple willn't accept your App. Apple will reject your App if you do like that. Human interface guidelines should be followed up.
Related
Basically, I want my app to be voice activated
If user asks my app to open then it should open
if the user says something it has to be typed in the textbox
if the user says to click on a button it has to be done
if the user wants to be voice read then it should read it out.
basically, I would like to read the user command sometimes if possible in the app and serve my user base the best
There is no much documentation available there,,, so I thought of asking the question here
This is not possible. You cannot use Siri with apps for anything else than what is implemented in the SiriKit framework and SiriKit does not provide any methods for just opening your app without actually handling an intent and custom commands are also not supported at the moment.
For dictation you can use the Speech framework and for the system to "read out" something from your UI, you need to support VoiceOver, which is part of Accessibility.
My purpose is to open secret screen (test screen) into my app. Best way is to display a normally hidden button, I use a fake messaging with Siri. App is ok for Siri request but no other special code is necessary, I just add appDelegate.m method with a postNotification, somewhere some code will append a button
- (BOOL)application:(UIApplication *)application willContinueUserActivityWithType:(NSString *)userActivityType {
if ([userActivityType isEqualToString:#"INSendMessageIntent"]) {
[[NSNotificationCenter defaultCenter] postNotificationName:#"modeTest" object:nil];
}
return YES;
}
Now ask Siri "Send message with 'AppName' " a view from my IntentWiewController.m is display, you can abord process by touching screen, application is running now but Notification is send, some process can easily be done like adding any secret control. Next run will hide button.
If I have sent a few messages in my iMessage app and I want to access previous messages (obviously just my own app-created messages, not just any messages the users have sent in their conversation), is there a way I can do that?
I can access the most previous message with this:
[self activeConversation].selectedMessage;
Any way to loop through previous messages that might not have even ever been clicked by the user (so simply storing it in user defaults is not an option)
There is no way to do this. Apple considers this to be a security/privacy issue.
I'm implementing an iOS app that handles a custom protocol.
Writing the method application(openURL:sourceApplication:annotation:) in my AppDelegate was easy but I'm left with a problem: I want that - once the user have done with the request - my app move to the background and send the user back to the caller sourceApplication (e.g. a browser, a QRCode reader, or any another app).
This is just like the difference between "tel:" and "telprompt:" url calls: in the former case the phone app remains active, in the latter case, after the call, the user is send back to the sourceApplication.
In order to let my app handle my custom protocol like "telprompt:" does, the only way I can think about is terminate the app once the user action is completed... but this is against iOS Human Interface Guidelines (they say "Don’t Quit Programmatically") and my app can be rejected by Apple.
On Android it is easy: you respond to an Intent with an Activity and when you call finish() on that activity the user is back to his previous app/browser/whatever.
Anyone knows a good way to achieve this on iOS?
Just to clarify:
my app don't call openUrl, it responds to openUrl requests from browser, QRCode reader, other apps;
I don't have to make phone calls;
when I handle a request I ask the user for some data, contact a server, and that's it: the interaction is finished and it would be very nice to drive the user back to previous app without let him use the home button.
I believe you should call openUrl when you are done, with the source app url in param.
That's what facebook does when you use the "connect with facebook" API.
I have an application which is using standard SMS functionality provided by MFMessageComposeViewController. I have an array of recipients visible in TO: field of the SMS dialog. The user has a possibility to remove or add new recipients. This is ok but my application need to know when the user edit this TO: field, because I have to do some other actions when the receivers field is changed by the user.
Is there any way to know if the recipients field are edited or no, after Cancel button click or Send button click?
I have method callback in my code:
-(void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
This method has controller.recipients but this array contains the recipients before calling of the message controller view.
This is not possible as of iOS 7. The only information provided by the delegate method is whether the user chose to cancel the message, send the message, or the sending is failed.
From the documentation:
This method is called when the user taps one of the buttons to dismiss
the message composition interface. Your implementation of this method
should dismiss the view controller and perform any additional actions
needed to process the sending of the message. The result parameter
lets you know whether the user chose to cancel or send the message or
whether sending the message failed.
To add to Enrico's answer, not only is this not possible from public API standpoint, it is also not possible by trickery, as since iOS6, the mail and message compose view controllers are rendered by different processes than your own, and their view hierarchies are completely hidden to your application. Indeed, if you were to inspect the view hierarchy of the message compose view controller's view, you would notice that none of what is on screen is actually there in the hierarchy. During the remote view's loading, the settings given to the message compose view controller are passed to the remote view controller. However, this is a one-way operation, and the properties are not updated (or read from) after the remote view is loaded.
This is to protect the user's privacy. This is a fundamental design of iOS. You should accept this, and design your application accordingly.
My app allows the user to make a phone call but I need to hide the number I'm calling to because it has a secret code within it. Is there any way to achieve this?
When I say "hide the number", I mean the phone number that appears in the the confirmation UIAlertView before calling and, if possible, in navigation bar when the call is in process.
Most definitely not. The phone number that gets passed to the OS when making the call cannot be modified or hidden from the user. (What if your app dialed 911?)
Also, how is a "secret code" passed via a telephone number?
Are you using the native phone number recognition code within a web view, or is this a custom button in your app.
In an app I've created, I have a button that the user can tap to call a phone number. This button presents a UIAlertView that I create myself (and therefore have complete control over what it says), and then in the alertView:didClickButtonAtIndex: delegate method, I do:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel://5555555555"]];
to initiate the call.
I think if you try to modify the way how ios Phone app works, your app might be rejected. I'm almost sure they will not happy to let your app dail a number without user's knowledge.