I am trying to send an apns token to my server when didRegisterForRemoteNotificationsWithDeviceToken is called. I can successfully print the token to the console, so I know that part is working.
I have also implemented such an endpoint on my web service, which is also working just fine with the rest of my app.
In the Apple Developer documentation, under the last section called Forward Tokens to Your Provider Server it says
Upon receiving a device token, open a network connection from your app to your provider server. Securely forward the device token and any other information you need to identify the specific user to your server. For example, you might include the user's login name or something that connects them to your service.
Practically speaking, how do I include information like this? I can't seem to pass additional parameters into didRegisterForRemoteNotificationsWithDeviceToken, like a user's access token, userid, etc.
Since I'm using SwiftUI, the all the user's info, including their access token, is in an @EnvironmentObject
in my view structs. Do I need to switch to a singleton or something?
question from:
https://stackoverflow.com/questions/65860400/how-to-send-apns-token-to-server-with-additional-data 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…