I'm having trouble with firebase notifications. I'm getting this error [Firebase/InstanceID][I-IID003009] Failed to fetch default token Error Domain=com.firebase.iid Code=0 "(null)"
which I guess leads to InstanceID.instanceID().token()
being nil
.
Things I've tried based on this and this, and this and this and this:
Following the instructions in the 1st and 2nd links several times
Enabling keychain sharing (actually was already enabled)
Switching push notification capability off and on again
Making sure bundle id is the same as the one in google's plist (although I used to change it back and forth)
Adding distribution and development certificates to firebase console (.p12)
Resorting to auth keys instead of certificates
Adding an observer for the
InstanceIDTokenRefresh
key in app delegateUninstall the app, clean, clean build folder, clean the derived data directory
Setting APNS token in both these ways, one at a time and together
InstanceID.instanceID().setAPNSToken(deviceToken, type: .unknown) Messaging.messaging().apnsToken = deviceToken
Querying
InstanceID.instanceID().token()
immediately, and after a 25 ~ 50 seconds delay.Setting
Messaging.messaging().delegate
and implementingmessaging(:didRefreshRegistrationToken:)
And maybe other things too that I can't remember!!!