Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cordova] My app hangs in iOS simulator after implementing CodePush SDK (randomly) #147

Closed
jrebagliatti opened this issue Mar 1, 2016 · 4 comments

Comments

@jrebagliatti
Copy link

Hi guys. I've followed the steps to implement CodePush in a blank Cordova app, and after adding the codePush.sync() call, my app hangs most of the times. I added the onStatusChange callback and confirmed that the function is called at least once before hanging.

    onDeviceReady: function () {
        codePush.sync(app.onStatusChange);
        app.receivedEvent('deviceready');
    },

I also found a workaround, which is to call the sync method from a setTimeout, a second before initialization.

    onDeviceReady: function () {
        setTimeout(function () {
            codePush.sync(app.onStatusChange);
        }, 1000);
        app.receivedEvent('deviceready');
    },

I'm deploying to the iOS simulator.

Any ideas?

Thanks,
Javier

@lostintangent
Copy link
Member

@jrebagliatti That is bizarre! We haven't seen this issue before. If you take a look at the Safari developer console, what do you see the logs saying when you call sync? That might help provide some indication of the problem.

Additionally, just so I have some more detail:

  1. Did the hang only happen after adding the call to sync? Specifically, did simply adding the CodePush plugin to your app not result in a hang? I wouldn't expect it to, but I just want to narrow the issue down to you actually calling into our SDK.
  2. How are you deploying the app? Are you using cordova emulate ios, cordova run ios, ionic run ios --livereload, etc? It would be helpful to know this so we can get a repro.
  3. Is onDeviceReady being called only once? If you added a breakpoint or a log message inside of it, would it be hit/logged multiple times? It's possible we have an issue with sync being run multiple times in parallel, so I just want to check if this is happening for you.
  4. If you simply call codePush.checkForUpdate does the hang go away? I want to try to narrow down the issue to sync if possible, as opposed to any network activity generated by our SDK.

Thanks! Sorry for the inconvenience. We'll try to narrow down this problem ASAP :)

@jrebagliatti
Copy link
Author

Thanks for your response @lostintangent!

Since the problem is in the app initialization I wasn't able to use the Safari developer console. Any trick I've tried to stop the initialization (and give me some time to start the console) makes the app to work properly...

Regarding your questions:

  1. Just adding the plugin doesn't cause any problem
  2. Yes, it is called only once. I've checked.
  3. No, it seems to happen with any of the CodePush methods.

@lostintangent
Copy link
Member

Did you try running "location.reload()" in the console to force a re-initialization to see the logs? That is how I always work around this debugging limitation :)

Also, could you answer question #2 above? That will be really useful in us trying to capture a repro.

It's super weird that you're hitting this issue just by calling any API method!

@jrebagliatti
Copy link
Author

Thanks for all your help!. I've restarted the simulator and the app started working as expected, so I'm closing the issue. I think the issue could be related with the simulator and not with the CodePush API.

Just FYI reloading the page didn't help because the app worked nicely every time I reloaded it. Regarding the question #2 I was using cordova run ios.

Thank you very much for your time!

@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants