How to send SMS on the iPhone without pressing send button? (If just for demo, not for the Appstore) - ios

I am working on an app that can automatically send a message to some specific ones (either emails or SMS) under some dangerous circumstances.
When someone is in danger, he or she has no time to press the send button. Is it possible for the user to approve sending messages in the app in advance, so the app can automatically send emails or SMS to others without telling the user?
I searched in StackOverflow, but found no similar answers.
This is just for a demo. It does not need to be approved by Apple.
Thanks in advance!

Take a look at the ChatKit framework.
It uses iOS private APIs to do what you want to achieve. Don't try to submit it to Apple though.
With this framework, you can programmatically compose and send text messages through iMessage/SMS.

Related

MailCore2 Alternative

I've spent a great deal of time creating an Objective-C based application for the iPhone. I incorporated MailCore2 so that emails could be sent without a dialog popping up (Apple's system of in-app email). My app works perfectly on all of my devices, including all outside devices associated with TestFlight beta testing. Unfortunately, the moment Apple reviews the app, they always reject it, saying that MailCore2 made an AlertView with the contents: "Error! Please connect to the internet or try again later.", and the email never properly sends.
My question is, is there an alternative to MailCore2? I've heard of MailGun, but I see no documentation on their site for either Objective-C or Swift.
Thanks in advance to all who reply.
Mailigun is a services and yes you can send mail with Mailgun, but not receive mail like normal email app. Anyway it is completely different from mailcore (Imap/pop). Mailcore is so hard to use...
If you need only send email i can provide you entirely code for achieve this using mailgun.

Read verification code automatically and access for Login in App in iOS

I am creating one App and it has verification phone number required functionality which allow user to enter into App. We send sms to the Users through the gateway and we need to read verification code directly from the SMS without typing code into App. But don't know how to read verification code automatic from the SMS and access in my App.I have gone thorugh the searches for this but could not find any path to move ahead. Is it allow in iOS and if Yes, can anyone tell me what to do to achieve it. Thanks.
Apple added this feature in iOS 12
just add:
if #available(iOS 12.0, *) {
self.verifyCodeTextField.textContentType = .oneTimeCode
}
to your controller and make sure your SMS has "Verification code", "code", "Login code" in it and apple will read those messages and show the last 1 minute received code on top of your keyboard for verifyCodeTextField.
You can check your SMS and there is a line under the number it means apple has detected it in your SMS and you are good to go.
If other people know the keyword in other languages that helps apple to detect the code I would love to know them.
From iOS 12 it is possible to improve the user experience for native textField (actually anything that implements UITextInputTraits to be precise) by:
myOTPTextField.textContentType = .oneTimeCode
More information can be found in docs
For the HTML you can achieve it by:
<input id="my-one-time-password-textfield" autocomplete="one-time-code"/>
More information can be found in docs
Your app can not read directly from the list of SMS messages. That would be a security risk.
But a couple things you can do would be 1:
allow the user to type in the verification code from the SMS (that seems to be the standard thing for most apps)
2:
use a custom URL scheme such as "myapp://verfication:12345" that when clicked in a SMS, goes straight to your installed app and does the verification. Here is a tutorial on how to do the Custom URL scheme thing.

How to send an email +attachment w/o showing the composer

I have inherited an app that, when certain conditions are met, will email data to a known server. The way the previous version worked is that the MFMailComposeViewController would slide up and the user could enter add'l info and then hit send. What we really want to do is send an email programmatically, transparently to the user (i.e. no visual representation unless it fails).
Is this possible, or does Apple not like apps to do this?
Thanks for any help.
IOS doesn't support to mail in background.
These are some questions asked previously on same topic.
1.Send Email in Background from iOS
2.How to send an email to a receipent in background in iOS5?
this might be useful to you.
http://iosameer.blogspot.ca/2013/01/sending-e-mail-in-background-from-ios_25.html
one more thing you can do is lock the fields in mail composer view.
Locking the Fields in MFMailComposeViewController

How to read a SMS in iOS and is it able to pass an string to the application via link in the SMS

do anybody know about how to read a SMS in iOS with Xamarin iOS ? and then I want to pass a string from that SMS to the application via link. For example when user click the link in the SMS it will pass a string value to the application and in the application a method is waiting to trigger that.
It's impossible to read incoming or storing SMS's due to iOS security restriction.
Although you can't directly intercept SMS messages, you can create a custom URL scheme so that if a user clicks a link in your message it will launch your app.
If Jason's answer of using a link to the app, there is an alternative. In my case a web service is sending down a code (two stage auth). When I know its going to be coming, I prompt the user to looks for it, and when it comes long press the message bubble, and copy the whole message to the pasteboard.
When the user switches back to my app, I've set a flag to look at the pasteboard, I see the message, extract out the code, and if it "works" the user can continue without further interruption.
Not as elegant as Jason's answer, but if you cannot control the sms content, its an option.
It is possible from iOS 12
textField.textContentType = .oneTimeCode
Please check this doc

Possible to send automated email?

The iOS SDK class MFMailComposeViewController can be used to let the user compose an email message.
What I'd like to do, is for the iOS app to send an email in the background, with no user interaction. Is this at all possible/allowed in the iOS SDK?
Nope. There isn't any API available to do this. You'd need to roll your own SMTP client and have the user enter credentials into your application. On top of that Apple may not approve this.
Unfortunately, I don't think Apple would ever allow this because (for example) then you could just get everyone's email address by auto-sending mail to yourself. :(
I actually wanted to implement something like this for the express purpose of alerting me when a critical error happens on an app in the app market.
Best solution would be to create an API (just ping a php file or something), and have it send the relative alert message to your email).

Resources