Is there anyone who can clarify the required methods for FCM using Swift 4.2 with an IOS Target of >= 10 to simplify: 1) no direct “data” msgs …. only notify/alert msgs thru APNS 2) I’m leaving Swizzling enabled even though some tutorials (without explaining why) tell me to turn it off
I’m finding that the IOS deprecation issues and some documentation omissions on the FCM side make this way more confusing than it needs to be.
can we get a simple matrix like: AppState | closed | background | foreground |
userAction: none (simple message arrival at IOS) dismiss notification tap notification select notification action open app directly -- no engagement with the notification
method being called in the above scenario is: blah …
also, it seems FCM creates it’s own token regardless of whether APNS has sent one yet; so I need different logic to detect if user has granted permissions before my server can assume that the FCM token will work at all … I guess I just won’t send FCM token to the server until I’m also sure I have an APNS token …. ???
Also, FCM docs make it clear that user-visible (ie Alert/Notification style) payloads are delivered THRU APNS/Apple.
Therefore, I think I can assume that FCM messages will not arrive until AFTER Apple has send me an APNS token.
But I seem unable to read or retrieve the Apple token from the FCM delegate method.
This code always returns an empty string for apns so I can't tell if my app is in a reliable state or not:
@objc func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) { print("Firebase registration token: (fcmToken)") let apnsTokenData = messaging.apnsToken let apnsToken = apnsTokenData?.reduce("", {$0 + String(format: "%02X", $1)}) ?? "" print("apnsToken:(apnsToken)")
Thanks for any clarifications!