【发布时间】:2021-04-30 10:22:49
【问题描述】:
我安装了https://ionicframework.com/docs/native/sms 用于从 IONIC 应用程序发送短信。以下是我的实现:
sendSMS(phoneNumber: string, text: string, event) {
this.sms.send(String(phoneNumber), text).then(result => {
console.log(result);
}).catch(error => {
console.log(error);
});
}
我正在 iOS 物理设备上对此进行测试。当我在全新安装后第一次单击按钮发送短信时,加载最多需要 30 秒,但在那之后,它会立即发生。即使在关闭应用程序并重新启动手机后。我查看了日志,发现:
文件:xxxx/ios/capacitor-cordova-ios-plugins/sources/CordovaSmsPlugin/Sms.m: 运行时:从后台线程调用的 UI API:-[UIViewController init] 只能在主线程中使用
Angular 11 版,IONIC 5.31.1 版,SMS ionic-native/sms": "^5.31.1", "cordova-sms-plugin": "^1.0.0"
【问题讨论】:
标签: ios cordova ionic-framework