Ad

How Can I Prevent Auto Initialization Firebase On Ios?

I'm working with firebase unity plugin on ios. I want to prevent firebase auto initialization and ask user for push notification permission later in the app. But firebase shows its annoying permission dialog on app startup.

  • Plugin version 5.4.4;
  • Xcode version 10.1;
  • Test device iPad ios 12.1.4.

And YES I've read this https://firebase.google.com/docs/cloud-messaging/unity/client#prevent_auto_initialization and tried to implement many times. It doesn't work. I've put this pair into my Info.plist:

<key>FirebaseMessagingAutoInitEnabled</key>
<false/>

Firebase just ignore this.

Ad

Answer

It was my fault (as usual). Just forget to remove this code from my FCMHelper class.

public void OnDestroy()
    {
        Firebase.Messaging.FirebaseMessaging.MessageReceived -= OnMessageReceived;
        Firebase.Messaging.FirebaseMessaging.TokenReceived -= OnTokenReceived;
    }
Ad
source: stackoverflow.com
Ad