firebase / quickstart-unity

Firebase Quickstart Samples for Unity
https://firebase.google.com/games
Apache License 2.0
826 stars 428 forks source link

[Question] Do I need to care about the log "Error: status is pending return the pending future" on iOS ? #1201

Open william821114 opened 2 years ago

william821114 commented 2 years ago

Please fill in the following fields:

Please describe the question here:

I always get the log Error: status is pending return the pending future when I call FirebaseMessaging.RequestPermissionAsync in the continuation function of Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread.

Except this error log, everything works fine. The prompt to request permission to receive notifications was shown as expected. The notification also received as expected.

Is there any way to fix it? Or I can ignore this error log?

(Related issue: #821) (It can be 100% reproduced from cloud messaging quickstart.)

paulinon commented 2 years ago

Hi @william821114.

Thanks for reporting this. While I try to replicate this issue, could you verify if this behavior persists using the latest version of the SDK (8.6.2)? Could you also confirm if your Xcode project is properly configured?

william821114 commented 2 years ago

@paulinon I tried SDK (8.6.2) and same problem as before.

paulinon commented 2 years ago

Thanks for letting us know, @william821114. I have also encountered this issue with our quickstart using the latest SDK version. Let me discuss this with the team, and we'll get back to you once we have updates.

cynthiajoan commented 2 years ago

Hi @william821114 can you please share your code snippet and logs for this issue? Thanks!

chkuang-g commented 2 years ago

This log seems to be from Firebase C++ SDK, specifically for iOS platform. https://github.com/firebase/firebase-cpp-sdk/blob/6946d8a470545758b55abde8d6ec84a8e2235e0f/messaging/src/ios/messaging.mm#L183

The error message occurs if RequestPermission() is called again before the previous request is finished.

Another note is that setting the listener can trigger this function as well. https://github.com/firebase/firebase-cpp-sdk/blob/6946d8a470545758b55abde8d6ec84a8e2235e0f/messaging/src/ios/messaging.mm#L175

My assumption is that you registered a callback function to FirebaseMessaging.MessageReceived along with your RequestPermissionAsync() call. If that is the case, I think the error message is, though annoying, but harmless. We should probably change the verbosity from error to log.

Otherwise, I wonder how you reach to this error. As @cynthiajoan mentioned, it would be great if you can offer the code snippet around your call to RequestPermissionAsync() and the logs.

Thanks, Shawn

william821114 commented 2 years ago

My code is the same as cloud messaging quickstart. https://github.com/firebase/quickstart-unity/blob/86f5b37cf8f643089c6302c9cb2add423cb0a5e6/messaging/testapp/Assets/Firebase/Sample/Messaging/UIHandler.cs#L78-L93

I registered a callback function to FirebaseMessaging.MessageReceived before RequestPermissionAsync() called.

DellaBitta commented 2 years ago

I was able to reproduce this as well. I don't think that there's an actual issue here. As previously noted, setting a listener kicks off an asynchronous call to RequestPermission. In this case MessageReceived and TokenReceived are configuring listeners.

The log is simply saying that implementation hasn't resolved the first attempt to request permission before the explicit operation of RequestPermissionAsync is invoked.

I'm going to mark this as a bug since I've been able to reproduce this, and the log states that an error has occurred. However, I believe that this isn't an error condition and that the correct resolution of this issue is to simply remove the log.