Error in evaluatejavascript with widget browser only on iOS and Livecode > 9.06

Ludovic THEBAULT ludovic.thebault at laposte.net
Fri Apr 17 02:05:23 EDT 2020


Hello,


I’ve a strange error :

I have an application where you can change the GPS coordinates from a marker on a map, in a browser widget.
For this I use the code "myJSHandler" which allows to retrieve in Livecode the GPS values of the map thanks to javascript.

The code works fine on desktop, iOS and Android except for iOS apps compiled with Livecode > 9.0.6 (and also with the new Livecode 9.6.0 dp4).
(I’ve not tested with Livecode 9.5). I’ve already tried to remove the widget browser and replace it with a « new ».

When I run the code in my app :
   on myJSHandler theCoords
       wait 100 milliseconds with messages

       put theCoords into tnewcoords

   end myJSHandler

// and the javascript in the html code of the map :
     function getCoords() {
        	liveCode.myJSHandler(document.getElementById('info').value ) ; 
      }

I get an error message:

343,0,0
863,0,0,runtime
864,0,0,Value is not of correct type for
assignment to variable - expected type
<type: livecode.lang.string> for
assigning to variable tResult in
com.livecode.widget.browser.browser-
EvaluateJavaScript
865,0,0,browser.lcb
866,0,0,859
897,0,0,1
865,0,0,browser.lcb
866,0,0,852
897,0,0,1

but the coordinates are well recovered...

If I change my code with :
 
on myJSHandler theCoords

 answer « New coordinates are saved !"

  #### no error, so, the bug is here ! ###
   wait 100 milliseconds with messages

   put theCoords into tnewcoords

end myJSHandler


 I don't get the error anymore!

I created a test application with the same code and the same map and I got no error !

You could get this sample stack here to see the complete code (but not the error !)
https://www.dropbox.com/s/pswhwvoinyrm387/testJShandler.livecode?dl=1 <https://www.dropbox.com/s/pswhwvoinyrm387/testJShandler.livecode?dl=1>

Thanks for your lights !


More information about the use-livecode mailing list