quickstart-unity icon indicating copy to clipboard operation
quickstart-unity copied to clipboard

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

Open william821114 opened this issue 4 years ago • 7 comments

Please fill in the following fields:

  • Unity editor version: 2020.3.19f1
  • Firebase Unity SDK version: 8.5.0
  • Source you installed the SDK: .tgz
  • Problematic Firebase Component: Messaging
  • Other Firebase Components in use: Core, Analytics
  • Additional SDKs you are using: none
  • Platform you are using the Unity editor on: Windows, Mac
  • Platform you are targeting: iOS
  • Scripting Runtime: IL2CPP

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.)

william821114 avatar Dec 08 '21 07:12 william821114

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?

paulinon avatar Dec 08 '21 17:12 paulinon

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

william821114 avatar Dec 13 '21 03:12 william821114

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.

paulinon avatar Dec 13 '21 15:12 paulinon

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

cynthiajoan avatar Dec 13 '21 20:12 cynthiajoan

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

chkuang-g avatar Dec 13 '21 20:12 chkuang-g

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.

william821114 avatar Dec 14 '21 10:12 william821114

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.

DellaBitta avatar Dec 20 '21 16:12 DellaBitta