ExceptionsManager.js:61 Cannot read property 'getCurrentPosition' of undefined - javascript

When I try to run Facebook's geolocation example, I get the error:
Cannot read property 'getCurrentPosition' of undefined on a red screen. When I just load up a mapview and set the follow user property to be TRUE, the gps is working properly in the simulator.
Any idea what's going on?

Sounds like RCTLocationObserver is undefined, meaning RCTGeolocation is likely not linked properly.
You'll need to link to it in the build settings as outlined here: https://github.com/facebook/react-native/issues/197
Or if you are using CocoaPods, add it to your Podfile.

There are a few things it could be. In my case, I was using a Navigator component in the same file, and importing it seems to override the navigator global. Try logging navigator and seeing what properties are set on it.
If you see 'ProxyComponent', and things associated with gestures, you're in the same boat I was, and doing your navigator.geolocation calls outside of the Navigator file will solve the issue.

Related

Issue with Google Tag Manager implementation. "Uncaught TypeError: Wb.set is not a function"

Recently I started having Issues with the Google Tag Manager.
I can't track it to a Tag or a Trigger (activated and deactivated individually to check).
The error started occurring this week (no updates were made to the system or template). I noticed when testing the implementation of a new Tag in GTM. That shortly worked but then this error message started showing in the console. Removing the new Tag didn't change the situation and since the code worked for a while (some 30minutes) I don't expect a direct relationship between the new tag and the error.
All I have is the console in the frontend that shows the following error message:
Uncaught TypeError: Wb.set is not a function
The error stems from this file:
https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXXX
Wb is started as a Map just a few steps earlier:
Wb=new Map(Vb.h.F);
Wb.set("style",{ya:4});
The GTM Script is copied and pasted from the GTM-Admin without any change made to it and is included in the header.php file of the Wordpress template. I tried copying it again and replacing the script that was in the header.php previously but the result was the same.
If looking at the actual error message in the console helps, the issue can be seen on the following URL:
https://www.bindella.ch
Any help in solving this or at least pointer to where to go look for errors would be very much appreciated.
Thanks
Very interesting, and yes, you're right, the error in the minified code makes no sense:
Let's try something different. First, just export your GTM container (the workspace that is synced with prod/live) as a JSON file in Admin section.
Open the file, look for something like set("style" See if you can find that Wb. Well, don't expect it to be Wb. I guess GTM minifies the code. It may be some weird chat bot, or something like that. From there, you'll be able to find the tag or variable that causes the issue.
I didn't look too deep into it, but that part of code looks sophisticated enough to be a part of the core container code. Actually, we can check it right here, on SO cuz it uses GTM too, let's do that.
Yes, SO has identical code. Looks like it's indeed core GTM. Well, there's a tiny probability that when you built the prod library last time, GTM had an issue and it deployed an artefact.
Try making a new workspace, make a nonsensical change in it and publish it to production. See if it lets you publish. Then see if that fixes the issue.
Now, if it doesn't then the next thing I'd try is trying to re-importing the exported JSON, forcing GTM compare the import to what's there and find differences.
Now if that shows no issues, then I would make a brand new container, load the config in it and try replacing the gtm loading script to see if the error still happens. It sounds like you can do that. If you can't, look a plugin like redirector to redirect the request to a different container.
Still the error with the new container? How about if you load a completely empty container? Got any errors?
There's a very slim chance that your front-end deploys one of a few vars GTM uses too, thus conflicting with your GTM. But it's very unlikely. Why would you use something like google_tag_manager or google_tag_data in the global scope...
If nothing helps and only the empty container doesn't give errors, then... well, then make a list of all tags firing along that error and start disabling them one by one. Or use breakpoints to narrow it down to the tag/library that causes it.

doc.pageWindowRect and doc.media are undefined in Adobe Acrobat Javascript

I'm using the Javascript API built-in to the Adobe Acrobat products, and trying to access the doc.pageWindowRect attribute.
I originally found that doc.pageWindowRect was undefined whenever I tried to access it, and through various posts on the AdobeUsers forum, found that I needed to activate the media extension first, by running something like console.println(this.media);
Normally this prints a result like: [object DocMedia]
However, on some computers used by our client, this just prints undefined instead. It seems that having this.media remain undefined means that doc.pageWindowRect will stay undefined too.
Does anyone know how to make sure this.media is defined, and thus enable doc.pageWindowRect? Or any other way of getting hold of the doc.pageWindowRect information?
I wondered if there might be a delay in activating the media extension (a suggestion I found online), and have tried repeatedly running code to display this.media and doc.pageWindowRect using app.setInterval, but even after waiting for a couple of minutes, they are still not defined.
Any suggestions would be greatly appreciated.
It seems that having this.media remain undefined means that
doc.pageWindowRect will stay undefined too.
Does anyone know how to [...] enable doc.pageWindowRect?
pageWindowRect belongs to the multimedia.api plugin. In Acrobat 9 and possibly other versions, this plugin is not by default loaded.
From what I can find in that scenario, one method for loading the multimedia.api plugin is to actually have media in the PDF file.
Default location for this plugin is: %Program Files%\Adobe\Reader 11.0\Reader\plug_ins\Multimedia.api
This might not be the fixing answer, but I hope the suggestion gives some insight. Good luck!

Implementing PDF.js Viewer example

I am running into an issue trying to implement the PDF.js viewer demo found here, but I keep running into an issue that certain properties are not being set. Checking the console there are two errors that I get:
First error:
app.js:883 Uncaught (in promise) TypeError: Cannot read property 'setPagesCount' of null
at Object.load (app.js:883)
at app.js:666
Second error:
app.js:870 Uncaught (in promise) TypeError: Cannot read property 'then' of undefined
at app.js:870
I have tried resolving this issue by diving through the code myself, and comparing it to the example with no luck. I have also looked around online trying to figure out why this may be happening and have still come up empty handed. It seems to me that this.toolbar is not being set with anything in the first error, but I cannot figure out why this may be.
Through looking around online, I believe I am setting this up properly, but am not 100% positive. Here is my setup:
<script type="text/javascript">
$(document).ready(function () {
var pdfDoc = '#pdf';
// Open the default file after the document is ready. Otherwise, PDFViewerApplication probably won't exist.
PDFViewerApplication.open(pdfDoc);
});
</script>
Has anyone ever experienced this before and would be able to help? If not, does anyone know where I can start to look?
An additional note is that I have moved the files outside of their original build and web directories. I thought that I changed the configuration paths in viewer.js to accommodate this, but perhaps I missed one?
It appears that my issue was do to me not adding the link resource for locale.properties in my HTML. Turns out the first error I was getting was more of a red herring, and was able to solve this issue by focusing on the second error.
I added this:
<link rel="resource" type="application/l10n" href="[your path to]/locale/locale.properties">
Where all the HTML for the viewer is located and it loaded right up.

Google Chrome javascript debugger: object inspect not working

I have been using Chrome to debug node.js code with node-inspector for a while now. However, lately I started having an issue with the debugger and I don't know why.
When I try to inspect an object, instead of expanding it and show me it's property it tries to modify its value, which is "Object".
The only way I found to see the value is to type in the console "obj.property".
I have this problem in the console as well when objects are printed.
In the image below, you can see that I can expand the Local and Global scope, but not any of the red marked variables. Also, in the console I can expand bar, but not bar.foo. It feels like anything marked with the format "variableName: Type" cannot be expanded.
Apparently my node-inspector was out of date (though not showing when typing npm outdated -g)
I updated it manually and it fixes the problem

Wikitude SDK project derived from samples doesn't work

I've been modifying the sample projects Wikitude SDK provides, and I'm facing a problem: it seems like this code never works:
this.tracker = new AR.Tracker("/assets/magazine.wtc", {
onLoaded: this.worldLoaded
});
That is, the world never loads, so the function "worldLoaded" is never called.
I have no idea why the world doesn't load as the file is the original provided in the samples and it used to work.
The difference seems to be trivial, I only added a new member to the World variable that would define some additional parameteres.
The error I get is
Uncaught TypeError: Cannot read property 'apply' of undefined
ade.js:1AR.i.__executeFunctionByName ade.js:1AR.i.callAsync ade.js:1l
Any idea how to tackle this?
It seems as if you have the ADE activated, which is not necessary on a mobile device. In your HTML, please delete the line (your path to ade.js might differ slightly). This will make the error go away.
In addition, my suggestion is to also add an onError event to the tracker. In this case, you'll be notified when the tracker cannot be loaded (wrong location specified, invalid file etc), and you can react accordingly.

Categories

Resources