first isolate the issue as much as possible. trace the apple dev token, directly from appdelagate, note this is different from the fcm token

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
 
Messaging.messaging().apnsToken = deviceToken // this will become the fcm token
 
  
 
// Convert the device token to a string
let tokenString = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
 
// Log the device token using NSLog
NSLog("Device Token: \(tokenString)")
 
Messaging.messaging().token(completion: { (token, error) in
 
if let error = error {
 
NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
 
} else if let token = token {
 
NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: token)
 
}
 
}
 
)
 
}

key part:

// Convert the device token to a string
let tokenString = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
 
// Log the device token using NSLog
NSLog("Device Token: \(tokenString)")
 
  1. get apple token out via console dump
  2. validate token for use on apple dev tools https://icloud.developer.apple.com/dashboard/notifications/teams/L2TLA7675Z/app/com.kiskolabs.valomotion.reactCapacitorClient.staging/tools/validateDeviceToken
  3. send test message via cloud tools https://icloud.develgoper.apple.com/dashboard/notifications/teams/L2TLA7675Z/app/com.kiskolabs.valomotion.reactCapacitorClient.staging/notifications

VERIFY Message sends to device IMPORTANT App must be in background VERIFY the app domain matches what your are testing IMPORTANT Apple ids are 64ch long, where FCM tokens are 163ch long

THEN if you get this working, that means push messaging on ios is working.

Now, you can move on to FCM:

  1. get FCM token by dumping from the frontend, or via the backend where you are sending the key to. Not this is a longer key at about 163ch
  2. go to the FCM console and send a campaign
  3. choose target single device
  4. add token and send

VERIFY the message sent VERIFY errors via the dashboard and analytics in FCM VERIFY that the p8 file key id and team id matches what you have on apple developer console, certificates REINSTALL a new p8 file by creating a new certificate if needed

Now you can move to the app or the backend

  1. verify keys or download .plist files and configure

Other moving parts

info.plist needs

<key>NSUserNotificationsUsageDescription</key>
 
<string>Notfications are used to show you completed actions such as the processing of a video.</string>