リンクをiOSアプリに直接送信することはできますが、handleCodeInApp
をYES
に設定してアプリ内のコードを処理してください。簡単にするために、Webページ(handleCodeInApp
がデフォルトであるNO
)のリンクを最初に開く方法を説明し、電子メールを確認してからモバイルアプリにリダイレクトして、ユーザーの意図した宛先に移動してください。
var actionCodeSettings = ActionCodeSettings.init()
actionCodeSettings.canHandleInApp = false
let user = Auth.auth().currentUser()
// This URL will be the deep link of the FDL. It is useful for
// passing state back to your iOS app to let it know that you were
// verifying a user of email user.email. This is also useful
// in case the user clicks the continue button a non iOS device.
// You should own this link.
actionCodeSettings.URL =
String(format: "https://www.example.com/?email=%@", user.email)
// This is your iOS app bundle ID. It will try to redirect to your
// app via Firebase dynamic link.
actionCodeSettings.setIOSBundleID("com.example.ios")
user.sendEmailVerification(withActionCodeSettings:actionCodeSettings { error in
if error {
// Error occurred. Inspect error.code and handle error.
return
}
// Email verification sent.
})
上記の手順では、確認リンクがユーザーに送信されます。ユーザーがリンクをクリックします。プロビジョニングされたWebページが開き、電子メールが検証されます。続行ボタンが表示され、iOSアプリがデバイスにインストールされている場合、クリックするとアプリにリダイレクトされます。
Firebaseのダイナミックリンクを使用してそのリンクを傍受します。 iOS版でFDLを設定すると、ここにリンクを扱う詳細については、こちらをご覧ください:
https://firebase.google.com/docs/dynamic-links/ios/receive https://firebase.google.com/docs/auth/ios/passing-state-in-email-actions#configuring_firebase_dynamic_links
Firebaseダイナミックリンクは、以下のURLでディープリンクがあります: https://www.example.com/?email=%@", user.email
これはFirebase認証に覆われています。 [電子メール操作における受け渡し状態](https://firebase.google.com/docs/auth/ios/passing-state-in-email-actions)のドキュメントを参照してください。それに基づいて何かを試してもうまくいかなかった場合は、[スタックした場所を再現する最小の完全なコード]を共有してください(http://stackoverflow.com/help/mcve)。 –
私はそのドキュメントに記載されているコードを理解していません。それはAndroidのパッケージに言及していますか?そして、それはURLを要求しますが、私はそれが求めているURLがわかりません。 –