Cordova Geolocation Issues in iOS 8 Beta 2 - javascript

This is more of an informational post: I've spent the past few days struggling with a non-functional geolocation app on the latest iOS 8 Beta.
At first I wasn't sure if it was isolated to iOS 8, or if it was an issue of device vs simulator, but after re-downloaded XCode 6 Beta 2 (my first download had a broken simulator for some reason), I confirmed that indeed, iOS 8 Beta 2 simulator did not seem to like my attempts at grabbing a geolocation.
At first the call didn't seem to work at all; then I made a change from including phonegap.js to including cordova.js and finally made some progress. The documentation is awful on this, as following guides in the official docs seems to lead one to believe they're interchangeable. I would suggest those with issues check that first.
Rather than running the navigator.geolocation.getCurrentPosition(....) callback functions as expected, it would instead hang and not do anything at all. Sometimes navigating away from the page and back to it would force the error callback, but it was very inconsistent. After setting a { timeout: 5000 } option, it seemed to keep timing out every call. There were no errors to the console, no errors in XCode, nothing. The success function just would not run, period, and neither would the error callback if I didn't explicitly timeout after X seconds. This is an error isolated to the iOS 8 Beta, so nothing of concern to most (yet), but I felt I should post this in case someone ran into it. I'll also be posting on the Apple Dev Center.

It's a known issue and is fixed here:
https://github.com/apache/cordova-plugin-geolocation/commit/4102a332b0c6b0c3513370a4c030a32e46a51e10#commitcomment-7791523
Just tested it in iOS8, it works.
Run the following command in platforms/ios folder of your phonegap project:
cordova plugin rm org.apache.cordova.geolocation
cordova plugin add https://github.com/apache/cordova-plugin-geolocation.git
For some reason it removes the CDVLocation.m from the compilation list, you need to revert that.
The entries In XXX.xcodeproj/project.pbxproj:
979B00CA27D6412CB8C6CF74 /* CDVLocation.m in Sources / = {isa = PBXBuildFile; fileRef = E3B4F7C4AF8242A09E9BF8C1 / CDVLocation.m */; };
979B00CA27D6412CB8C6CF74 /* CDVLocation.m in Sources */,
Without these 2 lines, the plugin is not available to use in the app.
If you have that file in source control just revert the deletions related to CDVLocation.m in XXX.xcodeproj/project.pbxproj.
If not try add CDVLocation.m to the Compile Sources step in the Build Phases in the project settings.

Related

Internet Explorer 11 SyntaxError in ckeditor.js

I am getting a weird issue only in IE11 - works fine when I turn emulator on for IE10 - where when I hover over my CKEditor, I receive literally hundreds of SyntaxError ckeditor.js (129,54), sometimes the numbers in the quote is (126,54).
The console errors shows when I hover the mouse into the ckeditor field, and returns a new but same error message every pixel I move the cursor. Hence why in a simple scroll or pass through with my cursor in the ckeditor field, I can get hundreds of errors.
My main issue at hand, is the ckeditor.js file is similar to this - https://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.7.3/ckeditor.js - in that it looks minified. Is there an un-miny version online anywhere?
Secondly, I am posting this to see if anyone has any obvious points I am overlooking, or advice for debugging CKeditor.
Here is unminified version: https://github.com/ckeditor/ckeditor-dev.
You can clone the repository, be sure that you checkout to stable branch such as 4.7.3. Useful might be also install package with npm.
Then take a look into samples folder. There is regular index.html file which use local ckeditor.js, so you should be able to build similar test page for yourself and track the error.

Cordova iOS plugins failing to load

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')

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.

Ripple Emulator doesn't fire events

I have newest Ripple Emulator installed (newest available in Chrome Store) and everything works just fine, except events. None of them fires (not only deviceready as in some other Stack Overflow question, none).
Neither manually (using Events pane) nor automatically (deviceready) fired.
When I use manual method, Ripple writes a line to the console, that it is firing an event, but nothing actually happens. My application does not react at all. I have backbutton event bind and it is not working in Ripple. And application stopped working at all, when I moved its init part to deviceready event, as it is not being fired. Of course, on target device everything is fine, so code should be correct.
What can be causing such behavior and is there any workaround for it?
EDIT: I have Ripple Emulator (Beta) 0.9.15 installed as Chrome Extension on Windows 7. All is just fine on destination device, so JS code (events handlers) should be fine.
After deeper investigation I've managed to solve this problem (at least partially -- some events are fired some are not). In my case it was a missing .js (PhoneGap source) file problem.
The key to the success was to:
Actually have PhoneGap / Cordova JS file placed in your app content and have it correctly referenced (valid path and file name) in your source files.
Have source file in correct version (2.0.0) as of writing this.
First can be especially confusing for PhoneGap Build users, which are instructed to remove source file. Reference in source file (<script type="text/javascript" src="cordova.js"></script>) should be untouched, but file, it references, should not exits. PhoneGap Build will inject this file (in proper version) during compile / build process.
This is fine for PhoneGap, but completely wrong for Ripple. If you want Ripple to be fully functional and be able to fire events (at least certain), you should leave that file in place. I found out, that this does not interfere PhoneGap at all. Apps are builded without problems, with and without that file in place.
Second is also important. I found out, that current version of Ripple is build basing on PhoneGap API 2.0.0, which is very, very old against currently available PhoneGap API 3.0.0. So, to have Ripple working nearly without glitches, you have to [browse PhoneGap repository(http://phonegap.com/install/) and grab PhoneGap 2.0.0 sources, released 20 Jul 2012 and extract cordova.js files out of it. Then place it in source folder of your webapp, add correct reference to it and try Ripple then.
At least some events should now be fired (some, like deviceready) may still fail.
Also, keep in mind, that everything, including event handlers, must be defined in a deviceready event listener code, or the whole thing will fail.
Ripple's JIRA issues, that might be related:
Support for the last version of PhoneGap,
Ripple Emulator under Windows doesn't fire events,
Ripple should check, if phonegap.js / cordova.js files really exists.
BTW: if you open up browser's console and manually fire an event you'll see a proper notice written to console by Ripple. Which means, that Ripple thinks, if fires an even on an emulated webapp, but it actually doesn't fire it.

NPAPI plugin problems in Windows 7

I have a NPAPI plugin which I have written and been using for some time with Firefox 3.x with no problems.
The object is defined as follows -
<object class="someClass" id="pluginobj" type="application/x-plugintype"></object>
I then call methods on it using the following format -
if( document.getElementById("pluginobj") != null )
{
document.getElementById("pluginobj").someMethod(someParams));
}
This is how I understand it should be done and has always worked fine. However, I recently installed this same plugin on a Windows 7 machine (with the same version of Firefox) and it now fails to find the functions defined in the plugin, so I get the following error -
Error: document.getElementById("pluginobj").someMethod is not a function
Nothing has changed at all within the plugin, this errors occurs for any method that is called, not a particular one, and it still works fine on Windows XP machines with no problems.
Very confused! Could anyone help? Thanks.
Note: I've also tried logging inside my plugin and it appears it's not even getting in to the NP_Initialize and NP_GetEntryPoints methods.
I have seen some suggestions around that it could be to with dependencies and libraries being linked to the plugin, but i'm not sure what could be missing on win 7?
Dependency Walker is showing a error saying that the "side-by-side configuration information is incorrect"?
Are you linking to other DLL files from your npapi plugin? Windows 7 works differently in how it finds DLL files, though I don't know the details. The times I've seen this with plugins in the past the problem was that on windows 7 one of the dll files couldn't be found. You could try copying dependency dll files to your system32 directory (not permanently, just to see if that's the issue). I would expect that there it would be able to find it.
If that's the issue, I unfortunately am not certain how to fix it, but it might help.
Another possibility based on the side-by-side configuration issue thing is that your visual studio project is creating a manifest that is telling windows that it requires a specific version of one of the DLLs that isn't there on windows 7. See: http://buffered.io/2008/05/17/resolving-side-by-side-configuration-issues/
I think I've resolved that issue in plugins before by disabling the manifest. I'm not sure; I've never had this issue with the way that FireBreath generates npapi plugin dlls, so I haven't needed to worry about it in the last year. You might consider looking at FireBreath, which works on both IE and Firefox (activex and npapi) and has a very good community for tracking down issues like this.

Categories

Resources