Closed cemerson closed 1 year ago
Can you reproduce this with a simple hello world cordova app? You have several plugins any one of them could be influencing the problem.
FWIW, On XCode 14.3 iPhone 14 simulator running iOS 16.4 doesn't appear to produce the problem for me. I also tested the same simulator but iOS 16.2, but the hello world app does run. Xcode 14.3 doesn't ship with Phone 8 Plus or iPhone X simulators, so I didn't test those ones.
So what this tells me is the cordova framework at the basic level works... but
It is definitely strange to hear that it works in some simulators but not others. Assuming the same iOS version, I would have thought the only difference between simulators is screen resolution rendering.
Thank you so much for replying. Good point / suggestions there.
So, as you suggest, the issue does likely lie somewhere in my configuration or my scripts I suppose. I will continue trying to find the culprit and will report back if/when I find the issue. Thank you again for your reply.
Just a bit more information that may help...
MyApp: [CDVTimer][TotalPluginStartup] 27.620077ms
MyApp: WF: === Starting WebFilter logging for process MyApp
MyApp: WF: _userSettingsForUser : (null)
MyApp: WF: _WebFilterIsActive returning: NO
MyApp: IAB.close() called but it was already closed.
MyApp: The preference key "AutoHideSplashScreen" is not defined and will default to "TRUE"
MyApp: SecureDeviceIdentifier.js loaded...
(NOTE: HERE Is where my normally Javascript would start doing console.logs ... but the log ends here)
Here, at the TotalPluginStartup
line, I believe is when all plugins has ran through their initialisation code. At this point or soon after you should have received a deviceready
event triggered, which based on the logging afterwards, I believe that might the case.
If deviceready
did fire, then as far as cordova is concerned, everything got initialized. Plugins may have further initialisation cause they can listen onto deviceready
themselves or whatever, but it will be on the plugin to notify somehow when it's ready.
So my comments yesterday might be a red herring. If the deviceready
did fire, then something on the JS side must be hanging preventing your app from initializing properly. I'm not sure how extensive your testing was with the different simulators but it could be a race condition and the actual simulator doesn't matter.
So here is what I'd probably do...
deviceready
event listeners. If the issue is indeed a race condition, hopefully it will break (or the act of pausing the JS execution may "eliminate" the race condition causing it to always work while stepping through the code slowly.)As you walk through your code... basically what you're looking for is when it may randomly stop executing unexpectedly. You may be doing an asynchronous call to the plugin that you're awaiting a response on and that is never coming back (for whatever reason). If you can find this, then it will probably at least lead you to where to spend your attention on.
Also another hint... but if have some infinite loop being triggered somehow, you may be able to detect that simply by hitting the "Pause" button in the inspector, which will cause the JS engine to break at the next executing statement. If the engine is at an idle, then it won't break until a JS line executes somewhere. If it's busy in a loop, it should breakpoint immediately. This technique doesn't work well however if you have timers page or some other constant JS executing frequently.
Thank you for such a quick (and helpful) second reply!
Using your advice (Safari Web Inspecting + iOS Simulator) I was able to find a error in one of my main JS files (outside any try/catch/console logs) that seem to be what was choking up the iOS simulators that weren't working yet. I'm not sure how/why some iOS simulators were able to forgive/move past the error and some weren't but in any case it looks like they're all working now.
Naturally I'm quite embarrassed that the issue was my fault not (really) a Cordova issue but thank you so much for your help and guidance helping me resolve it. Very much appreciated. 🙏🏻
No problem.
The art of programming is really about how well you can debug ;)
I'm not sure how/why some iOS simulators were able to forgive/move past the error
Yup, that also stumps me, but at least it appears to be working now.
So true. If I had nickel for every time a mysterious code issue traced back to a lack of or faulty try/catch/debug setup ...
Bug Report
Problem
My app fails to load on iOS Simulators iPhone 8 Plus or higher (up to 14) but works fine on the iPhone 6, 7 and 8.
App DOES load up successfully my Cordova index.html page (and scripts, etc) when I use the following iOS simulators:
App DOES NOT load/show my Cordova index.html page (and scripts, etc) when I use the following iOS simulators:
What is expected to happen?
What does actually happen?
Information
The logs for when the app works vs doesn't work are nearly identical as far as I can tell and no errors show up in the logs either.
No errors show up in the Xcode debug logs however somewhat interesting that when the app fails to load it appears the app never loads any of my javascript that normally loads (I know this because none of the usual console.log stuff shows up)
FWIW the Android build of the same app, same code works fine in simulators and on devices
Here is the full XCode log for when the app fails to load:
Command or Code
No code changes between when the app works or doesn't work - it's simply based on which iOS iPhone Simulator I use
Environment, Platform, Device
Version information
Checklist
PS: I hate to post an issue here but I am quite stumped w/this one and it's very challenging to find help on Google, StackOverflow, etc given how generic the issue is. My apologies in advance if this issue is some dumb mistake on my end.