Trouble with iOS and PhoneGap - javascript

Just started trying to adapt my html, css, javascript files to iOS using PhoneGap (I've also tried NimbleKit but the result is the same). I have a web app that I originally wrote for the Blackberry Playbook. The app works fine on the Playbook and in Chrome and Safari. However, when I try and run it through XCode with PhoneGap, the app displays on the simulator but does not seem to properly run the database coding (at least I think that is the problem). I do not get any build errors.
From the documentation, NimbleKit seems to just support its own internal SQLite, but PhoneGap seems to support WebDB, which is what my database is written in.
Finally, the simulator doesn't seem to run some global variables I have (I know, I know, don't use global variables) although that could be because they appear just after my DB initialization at the beginning of my javascript file.
Any thoughts or points in the right direction would be very helpful. Even if it is to some documentation which can help me debug the app in the iOS sim.
Thanks in advance.

Cold your problem be related to this?
http://phonegap.com/2012/04/18/ios-5-1-and-the-embedded-uiwebview-with-cordova/

I was facing a similar problem with PhoneGap and iOS Simulator last week,
all the code i wrote seem to have no problem,
anyway i tried this remote web inspector, and tried to create a database remotely using Safari Javascript Console,
bottom line I found that I was not able to create web database using iPhone Simulator,
looks like you need to deploy your app onto your device to make use of it.
I might be wrong, but that was what I found.

Related

Android Browser doesn't load my website in Android version 4.0.4

I've found some issues somehow related to mine here in SO but none of them helped me so far, so i'll try to explain the best i can.
When I open my website in Android Browser in the Android 4.0.4 version, it doesn't load any page of the website, it only appears a white page and do nothing.
I've tried with Google Chrome and Firefox and others browsers and it worked. I've tested in many devices with this version and it happens the same thing too, so it wasn't the device.
The website is this https://www.findhit.com
I've tried to open other websites similar that the website that i'm trying to open in this specific version of the browser, and it worked normally, so i have the conclusion that it's my website problem with this browser version.
I thought that maybe this Android Browser version doesn't have some compatibility with some native javascript functions that i'm using and because of that it doesn't load what it needs to start the app, because i've debugged it, and some variables wasn't like they have to be to start the app.
I've noticed that the events sometimes doesn't fire but i didn't really understand why, maybe it was because it didn't load some variables.
And i'm using phonegap inappbrowser to load my website in the mobile app and inappbrowser it's using the Android Browser, so i can't make it work there too because of that.
So if anyone have some clue what it can be or have some more information about compatibility of this browser with native javascript functions or events, i'll be really glad for any help.
Sorry if i'm being too ambiguous, but i don't know what more can i do about this, im in a long time trying to get a solution to this and i really have to make this work in this specific version of Android Browser.
Really thanks in advance.
I've finally found the solution for this. The problem it was that version of Android wasn't loading the window.document when the page was loaded. ( Still don't know why ) So the solution was, put the document in the window.prototype.document and the browser looks in the window.document if it doesn't find there looks in the prototype.
I don't know if it was the time of loading that the window doesn't had the document there yet and when it looks in the prototype had already loaded, im still trying to discover what was really going on there, but this solution fixed my problem though.

Phonegap push notification with parse.com

Im looking for a way to implement push notification on a phonegap application using javascript and parse.com. I found this turorial for iOS
http://www.ladeezfirstmedia.com/2013/08/01/tutorial-part-5-push-it-real-good-with-push-notifications-using-corona-sdk-and-parse-com/
, which seems pretty straight forward, and this tutorial for android http://www.raymondcamden.com/index.cfm/2012/10/10/PhoneGap-Parsecom-and-Push-Notifications.
However, Im using cordova 3.3. and rather stay away from editing the AndroidManifest, which I need to do in the last tutorial. Can any one point me in the right direction, maybe to a tutorial where I can use cordova plugin and easily combine it with parse.com by using javascript for both iO and Android? Btw Im building my project locally in the terminal.
What I want is to notify the user, when its their turn in a game.
Have a look at this answer I've just posted, I've just got the Android Parse PNs working:
How do I get Parse.com Push Notifications working in a Cordova/Phonegap Android app?
It does require you to modify the AndroidManifest and some of the Java files as well, but not a lot. I can't find a plugin that works without doing some of the work myself.
You can use the plugin for iOS as well, you don't need to edit any of the iOS source code but will need to generate a certificate for iOS push notifications, as documented on Parse.
https://parse.com/tutorials/ios-push-notifications

can i use indexedDB in developing firefox Os applications

I made an app for firefox-os which uses login functionality. I used indexedDB for local storage of username and password for future references. (Github Login)
But my app got rejected from Firefox marketplace as they say that they can't login on their phone keon and unagi. I have tested my app on Firefox Simulator. I'm able to login as well with my Github account.
Does indexedDB work in firefox-os smartphone as mentioned above? It's working fine in Firefox Simulator though.
Please help me.
Thanks
I don't think the error stems from any differences in the indexedDB code.
I would recommend trying to debug the app on an actual Firefox OS device - if you can't afford one, I'm pretty sure your local mozilla community would help you out there, by letting you use one of their devices for testing purposes - until you manage to work out the kinks and find the root cause to the problem.
Unfortunately testing the app on a real device sometimes can not be avoided, as every simulated environment has its limitations.
My other advice would be, that you should ask the Firefox OS app developer community. If you have the app source code uploaded online somewhere (e.g. on GitHub), you should drop a mail on the Mozilla Webapps Developer mailing list and ask people to have a look at your app, test it on a real device - maybe they can help you assess the problem.
IndexedDB is available on all Firefox versions including the one in Firefox OS. In fact, many of the built-in app use it.
I know that because I am one of the developers :)
I would suggest you test your app with localhost server on desktop Firefox, where the debug tool is available; it would be much easier than blindly try things out in the simulator. That's actually what we do to :-/ only the UI and the layout matters in the simulator environment.

How do I debug Internet Explorer on Windows Phone 7?

I'm not a Windows Phone developer, and I want as little to do as possible with anything related to Microsoft. Nonetheless, I need to get my mobile web app running properly on Windows Phone 7. What debugging tools are available for the platform? Something like the Webkit developer tools or Firebug would be ideal, either from the phone itself or more likely, remotely debugging from my computer.
If such a thing doesn't exist, I'd settle for being able to read Javascript error messages, and view the contents of variables using alert() or similar. At this point, all I know is that my JS is failing: I don't know where or why, let alone how to fix it.
My dev computer is running OS X, and I'd really like to be able to use these tools from OS X if possible. Assuming that debugging tools exist (which I really hope they do) are they designed for Windows only? If so, does anyone know how well they would work with Wine or similar?
EDIT: I have a physical Windows Phone 7 device, so I can use that. However, alert() doesn't seem to be working, which is why I'm posting this question. Does alert() normally work on the WP7 browser?
You'll likely find the Mobile Perf Bookmarklet to be the easiest all-in-one tool for testing any mobile device.
Works well on the iPhone/iPad/Samsung Galaxy Tab in my testing so far.
Quote:
It displays a menu with links that load other bookmarklets including Firebug Lite, Page Resources, DOM Monster, SpriteMe, CSSess, and Zoompf.
Unless you have a Windows Phone 7 device, you will need to run Windows in BootCamp and install the Windows Phone Developer Tools in order to test in IE on the emulator. I don't know about Whine, but I ran into major problems trying to test in Parallels - so based on my experience, I suggest keeping it as simple as possible.
There is no console in IE on the phone, so you will need to use alert, like you suggested, or just write text to a div on your page as a custom console.
If you really want to code in OS X (which I definitely understand), using a separate machine for testing IE in the WP7 emulator is going to be your best bet.
EDIT: I just tested alert and it did work fine on my Windows Phone. My guess is that a syntax error is preventing it from calling.
The following may be interesting
Simple IE debug tool for Windows Phone
Supports
Html traversing
Html node styles, properties, metrics
Reading console output
Executing js on device side from console (including intellisense)
Dynamic script injection - ability to debug live sites
Not supported
js breakpoints
Just wanted to add a note to say that full JavaScript debugging is possible now with Windows Phone 8.1 and Visual Studio 2013 Update 2. Full details are available at:
http://blogs.msdn.com/b/visualstudioalm/archive/2014/04/04/diagnosing-mobile-website-issues-on-windows-phone-8-1-with-visual-studio.aspx
I realize that this doesn't help the versions referenced in the original question (WP7), but I'm hoping this will help people who may find this question and are running a more recent version.
Something that has worked for me, is to test my mobile pages through the Windows Vista built-in Internet Explorer browser.
It comes with a script debugger ( which you have to enable in Advanced Options tab through the Internet Options menu ), and it seems that it gets really close to the Internet Explorer Mobile implementation.
Another tip would be, that, instead of using window.alerts, you can also use document.write or set output to a div content.
I'm using this hack to have console.log send info back to the server (it uses window.fetch, which I'm polyfilling, but could use xhr instead) https://gist.github.com/wheresrhys/bf93057ee3a594454582

jQtouch webapp behaving working fine on mac Safari but won't work on iPhone Safari

This is my first web app and I developed this one by following Jonathan Stark's Building iphone apps with HTML, css and javascript. Everything was testing ok on my mac safari, even when I select Develop > User Agent > Mobile Safari... You can view the above site in your safari and see it's working fine.
However when I finally (thought I had) finished everything and view stuffs from my iPhone safari, the whole world collapsed... Things are so messed up.
I'm using jQtouch and I somehow get an idea that it might because I'm pulling data from JSON files... Because if I pull data from the local storage (like favorites and combination), it's working fine without any issue. However if it's pulling data from JSON, then it'll turn into a mess...
My JSON file is located here:
http://hongteetrading.com/demos/pronouncecn/lib/names.json
The javascript used for pulling data:
$.getJSON("lib/names.json",function(data) {
$.each(data.names,function(i,val){
if(val.spelling==id){ ... }
I guess there could be any better ways of doing it? Or what kind of data-interchange formate you're using with jQtouch?
There are few errors in your HTML that you should fix before you do anything else. Use the W3C service to review them:
http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fhongteetrading.com%2Fdemos%2Fpronouncecn%2F%23home
Once those errors are fixed you will have a better chance of hunting down the specific things that are rendering differently between devices because you'll be conforming to standards.

Categories