• Register
0 votes
50 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

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 332 views
332 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 jwilliam 3.9k points
1 vote
1 answer 79 views
79 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 Martin K 6.6k points
0 votes
1 answer 13 views
13 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 Raphael Pacheco 4.9k points
0 votes
1 answer 8 views
8 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 Raphael Pacheco 4.9k points
0 votes
1 answer 86 views
86 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