Cordova iOS plugins failing to load - javascript

I've been developing a cross platform application which until recently has caused a few headaches. Android release will load the plugins without any issue at all, however, the iOS seems to have drop. I am unaware if it's something to do with the latest release of iOS (8.2) or something which has caused an issue in a most recent cordova update. Hopefully you guys would be able to shed some light on the matter.
I'm using jQuery Mobile, I've found an article while browsing through Stack Overflow that setting changeHash to false will counter act getting the message Resetting plugins due to page load. unfortunately it didn't work
$(":mobile-pagecontainer").pagecontainer("change", "#questions", {changeHash: false});
Another article I've found is that they simply tell me to ignore it, but something tells me not to do that.
In summary, all is well on Android, every plugin which I have installed is working without issue. On iOS non of the plugins are loading, and simply typing window.plugins should bring back an object of plugins but it's undefined. I've inserted a try catch to find the problem and this is the error which I am getting.
getQuestion: undefined is not an object (evaluating 'window.plugins.captureplugin')

Related

Debugging css and javascript on different devices

When I resize my browser on my mac, on any resolution it looks well, but when I'm on a older tablet of mine, the website looks so messed up.
What is the best way to capture that device info? So I can replicate on my machine? I still don't know is it a javascript or a css issue. How is this usually done?
Edit:
By the info I got so far, there is no tool that you can install on your device. Which would act as some kind of console where you could see, debug and interact errors like a js resource didn't load, unknown css property or any other error that you're able to see as a web developer in a chrome console for instance
Answering the question from some of the comments, so it's more visible to other people having the same issue :
You should be able to use remote debugging. You will need to use Safari on the desktop. I am not sure if you are restricted to Mac however... moduscreate.com/enable-remote-web-inspector-in-ios-6 The same also exists for Chrome/Android devices and developer.telerik.com/featured/… – xxcezz
Try modern.ie/en-us/tools not sure if it's useful. http://caniuse.com .
my best guess that would be iPad 1, running IOS 4/5. http://webdesign.tutsplus.com/articles/quick-tip-using-web-inspector-to-debug-mobile-safari--webdesign-8787

App unresponsive when javascript-profiling them

For a while I've been trying to run a JavaScript CPU profile of some applications I've developed, but everytime I start running the JavaScript CPU profiler in Chrome Dev tools, the application will stop responding at all (same as the profiler).
However, I noticed that this is not specific to my application, since I've been able to reproduce the same problem in other popular applications like Travis-CI.
I've been suspecting of extensions and plugins, but running without them doesn't seem to make a different -- the problem persists.
I've tested simpler apps with the same technology (the To-Do MVC example built in EmberJS) and that profile works just as fine.
I'm currently using Chrome 40.0.2214.111 m (64-bit).
Any idea on what the problem may be?
Update: I've tested both under incognito and guest browser mode. I thought the guest browser made a difference because I was able to profile my application once without problems. However, trying that again proved that the problem still persists.
Furthermore, I've found that the freezing time does not seem to be related with the application itself. Sometimes it'll hang when I focus an element, sometimes when I move around, some other times when I am in the middle of writing into a textbox. There seems to be nothing specific about the functionality of the app that's triggering this.
I've also tried disabling most extensions, without luck. I'll try disabling plugins as well and run as bare of a Chrome as possible.
Update 2: I've disabled all plugins and extensions completely, but the problem persists. I've also let the session go on to see if it eventually recovers. After around 2 hours, it was in the same situation. No bigger CPU consumption nor memory consumption, and other Chrome instances or tabs worked perfectly fine. I was able to close the developer tools but not interact with the original page anymore.
Update 3: I've just upgraded to Chrome 41 because it has been released in the stable branch, and I know it does include a few more things in the profiling section. I tried again and it didn't seem to make any difference.

Cordova plugins became undefined after restoring application

I'm working on html5/css3 application based on angularjs. And building this into android application using cordova 3.5.0.
Everything works fine until I hide application using 'home' button on the phone and then restore it: after that whole app reloads, and plugins became undefined.
Any ideas why this happening and how to fix it? Maybe I need to clarify something about project structure?
I wanted to try calling plugins using cordova .exec() but this method is undefined as well.
Well, I figured out what's the problem and I feel really stupid right now.
There is an option in dev options: "Don't keep activities", I was testing application on my co-worker's device and this option was turned on(I believe it turned off by default), so it was the root of a problem.

PhoneGap Android Querystring issue

I seem to be having a issue using phoneGap with querystrings
I wanted to have a page as:
view.html?matchid=1234
I have also tried:
view.html#1234
Both of these work in the emulator (running 2.3) but neither work when on my phone (ICS 4.0) - It errors as if the page doesn't exists...
I believe it may be a issue with the version of android. Does anyone know of a fix/work around I could possibly do.
Ideally it would be still using the query in some way. If not the other option I thought of was to use localStorage. Save something to it before going to a generic view.html page which then takes the Id out of localStorage....
There is an issue for this in the Android issue tracker.
http://code.google.com/p/android/issues/detail?id=17535
It affects all versions of Honeycomb and ICS.
It has been fixed and marked for Future release, so don't expect it anytime soon.
You can find some workarounds on the issue thread.

How can I know if a Javascript exception occurred in a PhoneGap application? (Android)

How can I know if a Javascript exception occurred in a PhoneGap application?
I'm using HTC Desire Z and Android 2.2.
I don't see anything in logcat and jsconsole.com does not seem to support exception transporting.
Using console.log to trac every exception is bit hard. Is there a solution for this or is this just how it is with Phonegap?
EDIT: It seems to be possible to capture at least some of exceptions with some really hacky wrappers. This some times can put you on the right track, but probably has some serious side effects and it won't certainly capture all the exceptions.
Uncaught exceptions should show up in logcat - at least the message and line number.
Otherwise you don't have many options. window.onerror does not work in Android AFAIK.
From a recent post from the PhoneGap blog:
It’s a mobile browser! How am I
supposed to debug it! The answer is
that you aren’t. You are going to
debug your HTML, CSS, and JavaScript
app in a desktop browser. The trick is
to remove any dependencies that you
have on PhoneGap before debugging.
http://www.phonegap.com/2011/05/18/debugging-phonegap-javascript/
Only if the desktop browser would work exactly like the mobile one...
Is your question about logging the exceptions or about debugging them during development?
I'm not sure about the best way of logging them, but to debug them you can use Weinre.
I just wrote about Weinre on another very similar question ( https://stackoverflow.com/a/9252262/172973 )
Basically it's a remote javascript debugger for phonegap. You can either setup your own Weinre server, or use the one at http://debug.phonegap.com/

Categories

Resources