You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when app first launch, the firebase token works fine, close app and some time later, the token become invalid.When we send notification, we receive "NotRegistered" error.
Relevant Code:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
NotificationCenter.default.addObserver(self, selector: #selector(refreshToken), name: .MessagingRegistrationTokenRefreshed, object: nil)
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions,
completionHandler: {_, _ in })
application.registerForRemoteNotifications()
return true
}
@objc
public func refreshToken() {
InstanceID.instanceID().instanceID(handler: {(result, error) in
if let refreshedToken = result?.token {
NotificationRequests.regFIRTokenAndDeviceID(refreshedToken)
}
})
}
public func setAPNSToken(_ deviceToken: Data) {
Messaging.messaging().apnsToken = deviceToken
refreshToken()
}
The text was updated successfully, but these errors were encountered:
[READ] Step 1: Are you in the right place?
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
when app first launch, the firebase token works fine, close app and some time later, the token become invalid.When we send notification, we receive "NotRegistered" error.
Relevant Code:
The text was updated successfully, but these errors were encountered: