arnesson / cordova-plugin-firebase

Cordova plugin for Google Firebase
http://arnesson.github.io/cordova-plugin-firebase
MIT License
1.01k stars 1.55k forks source link

Remote Config seems not work on iOS #850

Open ColDrekken opened 5 years ago

ColDrekken commented 5 years ago

Describe the bug I use the following code in platform ready function to fetch values from firebase remote config. This code works fine on Android but not on iOS.

window.FirebasePlugin.fetch(600,function (returnValue) { console.log("RC fetch" + returnValue); window.FirebasePlugin.activateFetched(function (isActivated) { console.log("RC activateFetched" + isActivated); //Check if the fetched remote config is activated if (isActivated) { window.FirebasePlugin.getValue("shuffle_limit_days", function (value) { console.log("RC VALUE LIMIT"+ value); $rootScope.rcdata.shuflle_limit_days = value; }, function (error){ console.error(error); }); } }); });

returnValue for fetch returns "null" at any time on iOS while it returns "OK" on Android.

Plugin Version 2.0.1

Smartphone (please complete the following information):

briantq commented 5 years ago

@ColDrekken Sounds like there might be a bug. With no full time developers on this plugin, it relies on community members to submit pull requests. If you would like to try to fix this, it should be pretty straight forward to find the code. You can find the JS API in firebase.js and the native iOS code in FirebasePlugin.m. You should be able to put break points in the native code and debug what is going on.

Please check out our Contribution Guidelines if you are interested in submitting a patch as that has all the information you need. Additionally, feel free to ask questions if you get stuck.

soumak77 commented 5 years ago

@ColDrekken could you test PR #870 to see if it resolves this issue? If so, I'll merge the PR and get a new release out.

ColDrekken commented 5 years ago

@soumak77 how can i test this?

soumak77 commented 5 years ago

@ColDrekken I updated our contributing doc to answer your question

soumak77 commented 5 years ago

@ColDrekken PR #870 has been merged, you can test the fix by installing the plugin from the master branch: cordova plugin add https://github.com/arnesson/cordova-plugin-firebase.git#master

ColDrekken commented 5 years ago

@soumak77 hello, i tested it but it seems no change on behavior.

returnValue for fetch returns "null" at any time on iOS while it returns "OK" on Android.

matthieup240 commented 5 years ago

I have the same issue on IOS the activateFetched function return "null".

`window.FirebasePlugin.fetch(60, () => {

    window.FirebasePlugin.activateFetched((isActivated) => {
      console.log(isActivated);
      //Check if the fetched remote config is activated
      if (isActivated) {
        window.FirebasePlugin.getValue("last_version_update", (value) => {
          console.log(value);
        }, (error) => {
          console.error(error);
        });
      }
    }, function (err) {
      console.log(err);
      alert(err);
    });
  });`

I always have the alert popup returning "null" on IOS platform with the master and 2.0.5 version :/

briantq commented 5 years ago

@ColDrekken @tux240 if you can reproduce this 100% of the time on iOS, I would suggest you put a break point in the native code. That should help you figure out if the problem is that Google is not sending the right value down to the client or if there is an bug in the native code when passing it to the javascript. Hopefully it should be pretty straight forward to diagnose.