chuchubee / stagewebviewbridge

Automatically exported from code.google.com/p/stagewebviewbridge
0 stars 0 forks source link

StageWebViewBridge.js - sendingProtocol variable has wrong value #36

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Load local html file via StageWebViewBridge.loadLocalURL
2. call AS3 function from local html file via StageWebViewBridge.call()-method
3. Debug on PC simulating an iOS-device
4. set breakpoint at onLocationChange-Method in StageWebViewBridge.as

What is the expected output? What do you see instead?
Expected: StageWebViewBridgeExternal.as will processs call (call the 
AS3-Function)
Result: nothing happens

What version of the product are you using? On what operating system?
AIR 3.4, Flash Builder 4.6

Please provide any additional information below.
This is only a problem when debugging on the Computer simulating an iOS device. 
It works when you run the application on a real iOS device. 
This is because the navigator.userAgent in the AIR-Debugger has the following 
value:
Mozilla/5.0 (Linux; U; Android 2.2; en-us) AppleWebKit/533.19.4 (KHTML, like 
Gecko) Version/4.0 Mobile Safari/533.19.4 AdobeAIR/3.4

as opposed to the value on the actual device:
Mozilla/5.0 (iPad; CPU OS 5_1 lik Mac OS X) AppleWebKit/534.46 (KHTML, like 
Gecko) Mobile/9B176)

This is because the following check in StageWebViewBridge.js will fail when 
debugging on the PC:
var checker =
navigator.userAgent.match(/(iPhone|iPod|iPad)/) === null ? false:true,

==> "iPhone|iPod|iPad" is not contained in the userAgent on the PC!

A workaroung for this could be to add the String "Apple" to the regex, since 
"AppleWebKit" is contained in both userAgents:
navigator.userAgent.match(/(iPhone|iPod|iPad|Apple)/) === null ? false:true,

However, I didn't get this to work because the call to the AS3-Function cannot 
be established when debugging on the PC (I have no idea why...). Best is to 
leave it as it is and only debug directly on the device.

Original issue reported on code.google.com by daniel.t...@gmail.com on 22 Nov 2012 at 2:43

GoogleCodeExporter commented 8 years ago
Hi,

I am actually working on V2 of the library. With the older there are some 
things I am not doing optimally. No more disk parsing, better to->as3 comm, no 
locationchanges, and sure it will work with simulator. Stay tunned.

Original comment by xperime...@gmail.com on 22 Nov 2012 at 3:42