如何等待访问短信的权限请求被确认

How to wait for the permission request to access the sms to be confirmed

我必须给我的几个联系人发短信。

在请求权限时,应用程序完全崩溃。应用程序重新启动后,将发送短信。我认为问题在于应用程序不等待许可确认。问题出在 Android。

    sms.contacts.forEach(async contact => {
      try {
        // Send sms
        await this.sms.send(contact.phoneNumbers[0].value, this.messageText)
      } catch (error) {
        this.errorsMsg.push(error)
        this.isOk = false
      }
    })

有人可以帮助我吗?

感谢kris_IV的帮助。

作为,我只需要使用for循环

for (const contact of sms.contacts) {
  try {
    await this.sms.send(contact.phoneNumbers[0].value, this.messageText)
  } catch (error) {
    this.errorsMsg.push(error)
    this.isOk = false
  }
}