• Register
0 votes
57 views

Problem :

I am trying to retrieve the phone number from my Firebase database, but no matter how I enter it into my database it returns an error on my device as follows:

"Message sent to invalid destination. Please check your number and try again. Msg 2127"

The message comes up as an automatic reply immediately after the text is sent out by me. I have tried entering it into firebase as 222-222-2222 and 2222222222 not actually only by using the number 2 but a valid phone number.

My calling function works fine but the same number being texted is not working at all.

var contactph: Int!

@IBAction func textButton(_ sender: Any) {

    if canSendText() {

          if let contactopt = contacpht{

      var messagePH = MFMessageComposeViewController()

        messagePH.recipients = ["tel:\(contactopt)"]

        messagePH.messageComposeDelegate = self;

   self.present(messagePH, animated: false, completion: nil)}}

    else {

let errorAlert = UIAlertView(title: "Cannot Send Text Message", message: "Your device is not able to send text messages.", delegate: self, cancelButtonTitle: "OK")

        errorAlert.show()

    }

}

func canSendTxt() -> Bool {

    return MFMessageComposeViewController.canSendTxt()

}

func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWith result: MessageComposeResult) {

    controller.dismiss(animated: true, completion: nil)

}

 @IBAction func callButtonPh(_ sender: UIButton) {

    if let contactopt = contactph{

    if let urlph = NSURL(string: "tel://\(contactopt)") {

    //    UIApplication.shared.openURL(url as URL)

        UIApplication.shared.open(urlph as URL, options: [:], completionHandler: nil)

}

}

}

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I solved the issue by changing messagePH.recipients = ["tel:(contactopt)"]

To below code:

messagePH.recipients = [String(contactopt)]

9 7 4
38,600 points

Related questions

0 votes
1 answer 461 views
461 views
Problem : My code works perfectly on my friend's laptop But throws below error on my laptop. “Error: a jni error has occurred, please check your installation and try again” I have tried running the code on a Eclipse Juno using Java 7. I have also tested it and ... my final year project and I need it to work on my laptop at any case, I will be very grateful to anyone who solves it.
asked Jan 18, 2020 jwilliam 3.9k points
1 vote
1 answer 121 views
121 views
Problem : I am very new to Programming. I am trying to learn Android Programming with the help of tutorials. I have installed Android Studio (1.2RC0) on my machine. My newly installed Android Studio (1.2 RC0) always shows below error to me: Error running ... Please fix your project and try again.   I am unable to understand above Android error. Please guide me in fixing above Android error.
asked May 16, 2020 Martin K 6.6k points
0 votes
1 answer 66 views
66 views
Problem: I am right now using the react-google-invisible-recaptcha. However it is not working for me during the page load it shows the following message: "Cannot contact reCAPTCHA. Check your connection and try again." Please Note: I have the broadband internet connection which is very fast. Please let me know how can I use the invisible-reCAPTCHA and overcome the existing problem.
asked Jul 23, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 14 views
14 views
Problem: I have created a small YouTube streaming script which randomly plays the YouTube music videos or from the queue. It has worked fine for many months up until a few days back in which it really does not seem willing to load the videos while using the iPad or iPhone ... to think that it is actually not an error in my code but something must have either changed with the API or with a Safari.
asked Sep 5, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 91 views
91 views
Problem : I want to update Orion ContextBroker using the command yum install contextBroker. But unfortunately I am getting the following error: Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again What could be wrong? Any clue?
asked Nov 26, 2019 alecxe 7.5k points
0 votes
1 answer 219 views
219 views
Problem : I am having the following error whenever I am trying to open Excel Online in Chrome, But Excel Online in Safari is working fine for me. Does anyone know how to fix this issue? Sign in Something went wrong and we can't sign you in ... . Please try again later. The Microsoft account login server has detected too many repeated authentication attempts. Please wait a moment and try again.
asked Nov 26, 2019 alecxe 7.5k points
0 votes
1 answer 50 views
50 views
Problem : I manage some of my WordPress,WooCommerce online shops which are running problem free from few years now. In recent times, we have noticed that the transactions via Paypal have not been working for us. I tried to process the order myself using the PayPal and ... saying that "there is not a problem with PayPal" So without even pulling apart the WooCommerce code, How can I fix the issue.
asked Jan 3, 2020 alecxe 7.5k points
0 votes
1 answer 48 views
48 views
Problem : I recently installed a Laravel 5.0 properly by cloning it in git, and composer install, but when I ran it to my browser http://localhost/laravel/public/, it gives below message : "Whoops! looks like something went wrong. please give us a few ... I tried to copy a env.example to .env below is result “RuntimeException in compiled.php line 5599: OpenSSL extension is required.”
asked Feb 3, 2020 jwilliam 3.9k points
0 votes
2 answers 97 views
97 views
Problem : While trying to compile my C program I encountered following error agreeing to the xcode/ios license requires admin privileges, please re-run as root via sudo.
asked Nov 16, 2019 peterlaw 6.9k points
0 votes
1 answer 17 views
17 views asked Oct 2, 2020 SapperIt 1.2k points