I'm not saying that i can help too much because truth be told i'm a novice at phonegap, but perhaps posting some of your code could help get to the root of the problem.
2 people found this helpful
Are you referencing remotely hosted libraries on your server or a CDN? If so, if the security settings for you app are not correct, they will not be loaded. This issue will NOT be present when testing in a browser on the desktop.
Thanks Chris. However, I'm not referencing any CDN hosted libraries. Here is a gist of the code output to the browser. There are a number of differences in that output to what I see when I view the Elements tab of the Weinre debugger when running via PhoneGap Developer App:
- There are a bunch of script tags that look like <script src="file:///var/mobile/Containers/Data/Application/1C07B402-DC7F-4455-A0E6-7F90D2623A3D/Librar y/NoCloud/phonegapdevapp/www/cordova_plugins.js"></script>.
- The socket.io.js file is loaded via a script tag that has a full path (i.e. src="http://mobile.app.ngrok.io/socket.io/socket.io.js").
I should also mention that when I publish via Xcode, everything works fine.
Maybe move the app.init call after all the libraries have loaded?
The problem with Weinre is it won't catch errors at the beginning of the app starting up.
You could try remote inspection via Chrome or Safari depending on which platform you are targeting (Android v. iOS).
Laying odds that you're running into a timing issue. Loading files locally (as in, using Xcode) is a whole lot faster than loading files from your dev server (which is what is occurring when you use PhoneGap Developer App). I agree with Chris: wait on calling your initialization routines until all scripts have been loaded. You might also consider using the "defer" attribute of the script tag.
Since you're using Angular and CSP, however, you may also need to worry about Angular's CSP directive.
Thanks for your advice kerrishotts. I'll give that a try shortly and report back.
I am Facing the same problem see below code in my app
The app bundles the
phonegapnpm module as a dependency. This means that there is no need for a global installation of
cordova. By editing the
package.json, you can specify the exact version of
phonegapto compile the project.
Since a global install of the
phonegapmodule is not required,
npm runscripts to compile and run the application. This allows the app's
plugins/directories to be removed and rebuilt each time, ensuring a consistent build using the correct PhoneGap, Cordova, platform, and plugin versions.
I'm unclear if you're asking a question here or not. You indicate that code is below, but then none is posted. If you're having a problem, please post some code that exhibits the issue, along with any error messages you may be receiving.