Flutter url_launcher 发送短信未在 imessenger 中加载号码

问题描述 投票:0回答:0

您好,我正在尝试在 iOS 移动设备中使用 url_launcher 包发送短信。用户单击我的应用程序上的一个按钮,url 启动器触发 iMessage 并填充要发送的电话号码和消息。以下是我用于单击按钮的代码:

final Uri smsLaunchUri =
      Uri(scheme: 'sms', path: '3939393939', queryParameters: <String, String>{
    'body': Uri.encodeComponent('Example Subject & Symbols are allowed!'),
  });
  if (await canLaunchUrl(smsLaunchUri)) {
    
    launchUrl(smsLaunchUri);
  } else {
    throw 'Could not launch';
  }
}

我在信息 plist 文件中有以下内容:

<key>LSApplicationQueriesSchemes</key>
    <array>
        <string>sms</string>
        <string>tel</string>
    </array>

但是一旦启动信使,“收件人:”字段中就有“无名称”和加载圆圈。消息字段中也没有消息。该号码通过“测试联系人”保存在模拟器设备中。

flutter sms url-launcher
© www.soinside.com 2019 - 2024. All rights reserved.