Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem launching Whatsapp from flutter on IOS

Sending message through whatsapp in Flutter is not working on IOS. It works fine on Android but on IOS whatsapp is not launching. I tried 3 different ways but unsuccessful in all of them.

In Runner Info.plist

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>whatsapp</string>
</array>

1) First I tried this way to send message via message

var whatsappUrl = "whatsapp://send?phone=$phone&text=$message";
  if (await canLaunch(whatsappUrl)) {
    await launch(whatsappUrl);
  } else {
    throw 'Could not launch $whatsappUrl';
  }

But it gives an exception on launching whatsapp

enter image description here

2) Second way I tried is found from this link this but it giving an error that page not found

String url() {
  if (Platform.isIOS) {
     return "whatsapp://wa.me/$phone/?text=${Uri.parse(message)}";
  } else {
     return "whatsapp://send?   phone=$phone&text=${Uri.parse(message)}";
  }
}

if (await canLaunch(url())) {
   await launch(url());
} else {
   throw 'Could not launch ${url()}';
}

3) last I tried to call whatsapp url

String message = 'Hi, I see your Ad on Yallamotor and I am interested in your car '+title;
if (Platform.isIOS) {
  await launch("https://wa.me/${phone}?text=${Uri.parse(message)}");
}

but it gives error on whatsapp like we couldn't find the page you are looking for

enter image description here

like image 936
Haseeb Ahmad Avatar asked Jan 24 '26 12:01

Haseeb Ahmad


1 Answers

Whatsapp supports Universal URLs on iOS devices.

The format is:

https://wa.me/<number>?text=<urlencodedtext>

Examples:

Use: https://wa.me/15551234567

Don't use: https://wa.me/+001-(555)1234567

Probably you are calling this URL with incorrect format in number.

Refer Whatsapp FAQ for iOS, Android.

like image 162
Lal Krishna Avatar answered Jan 27 '26 00:01

Lal Krishna



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!