PhoneGap location issues - jquery-mobile

I'm using PhoneGap 1.0 for iOS right now to do some coding with google maps. The system is also running on jQuery Mobile which I think is half the issue.
When trying to pull up the users location I get the following error in the console: Ignoring gap command with incorrect sessionKey; expecting: 615717337 received: (null)
I'm assuming that since the map page is an 'external' page the original phonegap call made on the home screen of the app isn't passing a session along to the other pages. Is there a way to retrieve this sessionKey?

It looks like the errors I was experiencing are normal and do not have effect on the geo location. There is currently a bug with the iOS Simulator and PhoneGap that causes geo location services to timeout on the simulator, but everything works as expected on an actual device.

Related

Receiving webcam error when using AR.js in Cordova

I have been trying to get AR.js to work within a web application that I am creating. I am building this application as a plugin that is subsequently loaded into a platform called BuildFire (buildfire.com). The app should just load as a web app inside of an iframe within the actual app itself. When I load my plugin, it comes up with an error saying:
Webcam Error
Name: NotReadableError
Message: Could not start video source
It works perfectly fine if I load the same code in a mobile browser window, but not within my web app when loaded in the context of the cordova iframe. Is there some permissions issue that is occurring where it can't access the camera in the same way the browser allows it to?
This is happening on Android on an S8, though I suspect the hardware doesn't matter too much in this case.

Webpage crashing on any web browser for iOS device

I am trying to access webpage on various browser on iOS Device, but it seems that after loading some part of the webpage, it redirects automatically and then crash the page and shows the webpage was reloaded because a problem occurred for 2 seconds, and then show A problem repeatedly occurred on "URL for page as below"
I tried this URL on a desktop and it was not behaving well. I don't know if it is there rotating image code, or the JavaScript code they have running the "design your shoe" features. But this site had weird stops and starts and mouse jumps when I tried it.
I don't have an iOS device handy, but I'm thinking it is not you, it's the site.
Try it on another device.

How to view javascript errors in ios simulator launced by phonegap?

I can't seem to find an answer to this seemingly simple question. I have an app that i've built using the command line phonegap tools and when i start this app it opens up. i am using something called ios_sim (https://github.com/phonegap/ios-sim) which launches the app in the simulator and does not launch xCode (i don't quite understand why this is a feature, it seems like xCode has some useful tools)
Anyhow, my app is not functioning the same way that it does in the browser and i need to debug it. I have also already installed Charles to inspect the requests and i can verify that the correct data is coming from my API so my assumption is that there is some sort of javascript error in rendering the page (the page is partially rendered btw).
All i want to do is view the javascript errors. the same way that you would in the console if you were looking at a web page.
how do you do that?
You have to use Safari Remote Debugging with Web Inspector. See in the relating cordova docs how to do that!

phonegap iOS app working on simulator but not in device. How to debug

I just finished developing a Cordova / Phonegapp app. When I test it on iOS simulator it all works fine and quick, but, when testing on device it works only part of it.
My app is a game with the kingdom background and has 8 buttons (8 buildings).
When I click on each building it leads me to a screen representing what it's inside the building, but one of them doesn't work and gets my app frozen.
How can I see fail or crash reports that helps me debug my app on device?
If you provide full path to your file i.e. "file:///Users/.../someDir/some.html" it will work only on simulator running on the same machine where your project is.
I suggest just adding the additional path to the file you want to access i.e. if you are in "/someDir" you will need to provide only "some.html" or if you want to access parent directory just use "../".
As far as debugging Cordova app, I suggest downloading this plugin and using console.log instead of alert.
Hope this helped.
Ok, I found a "spartan" way to debug my app via alert and found that an url wasn't set properly (still don't know why it worked on simulator)

iOS: Did Apple disable HTML5 offline capability for web apps saved to the home screen?

I've been doing lots of work in getting a few web apps to work offline on iOS using the HTML5 manifest. I've ran across the typical problems everyone else has and fixed them and everything seems to be working fine—except in the case where I save the web app to the desktop on my iPhone 4.
If I do this and then enable airplane mode, I get the following alert when trying to access the app via the home screen: "your-app-name could not be opened because its not connected to the internet." Accessing the app via Safari browser works fine while offline.
If anyone knows if this is an error on my part, or even the slim possibility of a work around, do tell.
Even downloading the new Financial Times web app (very well done with extensive localStorage support) results in an error when accessing it offline from the home screen.
Technical specs: Running iPhone 4 with iOS 4.3.3 (but also saw the issue in 4.3.2)
After reading the comments (especially Rowan's) I ran more tests and found the answer:
No, Apple did not disable HTML5 offline capability for web apps saved to the home screen, it works - for the most part. There is a bug that will make it not work. It doesn't seem to have anything to do with your manifest setup (unless perhaps it downloaded a bad manifest or incomplete manifest at one point.) We don't know how widespread it is but the fix is to clear your Mobile Safari Cache.
Here's the steps:
Close the web app (make sure its not sticking around in the background).
Cleared Mobile Safari cache: Settings > Safari > Clear Cache
Reopened the app (for caching).
Close the web app again (make sure its not sticking around in the background).
Enabled "Airplane Mode": Settings > Airplane Mode
Reopened the app.
It should now work offline. If it doesn't then its probably a separate manifest issue in your app. Looks like a weird bug with the browser cache - or perhaps the cache was completely full? Who knows, but that's the answer. Thanks guys.
iOS seems to be very sensitive to load issues when offline.
I was getting your "could not be opened" error when offline on a page I was working on. The problem turned out to be that the page created an iframe pointing to a site that didn't have an AppCache. Removing those iframes fixed the issue.
In my case, I handled it using window.navigator.standalone which tells you whether you're running in an iOS homescreen app. The code looked like this:
if (!navigator.standalone) insertFrames();
add this to your html:
https://web.archive.org/web/20170201180939/https://jonathanstark.com/blog/debugging-html-5-offline-application-cache?filename=2009/09/27/debugging-html-5-offline-application-cache/
I found it massively useful - even though I've created my manifest file and compared it to other people's manifests this JavaScript debugging script gave me the clue I would have never found otherwise. I apparently had syntax error in my manifest ... long story short I had to remove everything and add the paths to each file/image one by one. The end result was the same however it worked... how weird!!! does whitespace / comments affect the syntax of the file?

Resources