メソッドのスウィズリングを無効
iOS で Firebase Cloud Messaging をデバッグするでスウィズリング(swizzling)をオフにしなくてもdidRegisterForRemoteNotificationsWithDeviceTokenが発火すると書いてあるがしなかった。
Firebase Cloud Messaging(FCM)を使う際、SwiftUIで下記デリゲートメソッドを動かすにはスウィズリングを無効にしてdeviceTokenとapnsTokenのマッピングをする必要がある模様
code:swift
func application(application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Messaging.messaging().apnsToken = deviceToken
}
スウィズリングが無効: APNs トークンと登録トークンのマッピング
https://gyazo.com/a4a58dbfac33db7967c7b9d786ecf552
設定にはinfo.plistにFirebaseAppDelegateProxyEnabledをNoに設定することで可能
https://gyazo.com/30bb6eeb8a728dd36c0f042b5dad8a29