I recendly swtiched over from Google Cloud Messaging to Firebase Cloud Messaging.
With GCM I had to choose the sandbox option. As described here : https://developers.google.com/cloud-messaging/ios/client#obtain_a_registration_token see point 3.
To receive push notifications in debug mode I had to do something like this
[[GGLInstanceID sharedInstance] startWithConfig:instanceIDConfig];
_registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
kGGLInstanceIDAPNSServerTypeSandboxOption:@YES};
To receive push notifications in an App from the AppStore (e.g. TestFlight) I had to say:
kGGLInstanceIDAPNSServerTypeSandboxOption:@NO};
Now I can not find something like this in Firebase. First I thought great no switching these stupid values anymore. But now I do not receive any push notifications in my TestFlight apps anymore.
In my debug console when I debug on the device one output is like this:
<FIRInstanceID/WARNING> APNS Environment in profile: development
Which is good for local debugging, but unwanted in TestFlight. (I do not know if this happens for TestFlight apps, since I do not have a console for them.)
So my question is: Does anybody know if I can manually change this Sandbox option in Firebase anyhow?
Thanks,
Simon
It is about the
setAPNSToken()
function. You need to set theFIRInstanceIDAPNSTokenType
toProd
while adding the device token. I use swift for that, the code I used is this:also if you just want to remove the warning, you may use a production provisioning profile.
I solved the problem by adding the code below to the project.
FIRInstanceIDAPNSTokenType.Sandbox will be used when you install the app though TestFlight,
and FIRInstanceIDAPNSTokenType.Prod when your app goes live on the App Store.
Be safe, use below:
Do not unnecessarily set sandbox token to prod type and vice versa.
I followed the documentation provided and was having the same issue, then I tried the quick start app and it worked. The key seems to be to add the logic to connect to the FCM after obtaining a token, this step is missing in the setup documentation. After I did this it worked on my development device outside of TestFlight without any other special sandbox switches.
https://github.com/firebase/quickstart-ios/blob/master/messaging/FCM/AppDelegate.m#L85