I have a Dashcode developed webapp that I ported to a UIWebView object in Xcode. I have a menu in native obj-C that the user can touch, to send messages via stringByEvaluatingJavaScriptFromString to the webapp. The webapp responds accordingly and changes the view of my stackLayout with setCurrentView. But it usually then stops responding to user touches. I can still scroll up and down. I can still navigate with the native obj-C nav bar, but nothing from my javascript onClick events. I confirmed as best I can that the events are no longer firing and that its not a javascript code error on my part. It sometimes even still works briefly, but then stops working again after a few seconds. I suspect that's just lag in whatever disabled it.
I monitored the isUserActionEnabled property from the UIWebView, and it does not change when the error occurs. When the user touches a button on the native code side, it sends an stringByEvaluatingJavaScriptFromString command to execute a javascript function called navigationHomeCall(). When I debug this in Dashcode, and call the function in the Evaluator Window, it does the same thing. It stops the javascript from receiving anymore events. However, if I keep calling my navigationHomeCall, navigationBackCall, and navigationForwardCall functions from in the Evaluator Window, the events will eventually start working again. Sometimes it takes 1 or 2 calls before it works. Sometimes more. But once it starts working, another call will stop it working again.
It seems that evalJS can randomly enable or disable javascript events. I looked through the javascript object model to see what, if any, properties change to cause this but the model is huge, I can only see maybe 20 properties on the screen at a time, and Dashcode keeps changing the window to the Run Log everytime I make the call to invoke the error. It makes troubleshooting very slow.
Has anybody successfully used stringByEvaluatingJavaScriptFromString and javascript events without any problems? I'm not the first one to try this, am I?
I monitored the isUserActionEnabled property from the UIWebView, and it does not change when the error occurs. When the user touches a button on the native code side, it sends an stringByEvaluatingJavaScriptFromString command to execute a javascript function called navigationHomeCall(). When I debug this in Dashcode, and call the function in the Evaluator Window, it does the same thing. It stops the javascript from receiving anymore events. However, if I keep calling my navigationHomeCall, navigationBackCall, and navigationForwardCall functions from in the Evaluator Window, the events will eventually start working again. Sometimes it takes 1 or 2 calls before it works. Sometimes more. But once it starts working, another call will stop it working again.
It seems that evalJS can randomly enable or disable javascript events. I looked through the javascript object model to see what, if any, properties change to cause this but the model is huge, I can only see maybe 20 properties on the screen at a time, and Dashcode keeps changing the window to the Run Log everytime I make the call to invoke the error. It makes troubleshooting very slow.
Has anybody successfully used stringByEvaluatingJavaScriptFromString and javascript events without any problems? I'm not the first one to try this, am I?