Re: Running JavaScript in iOS WebView.
Re: Running JavaScript in iOS WebView.
- Subject: Re: Running JavaScript in iOS WebView.
- From: Geoffrey Holden <email@hidden>
- Date: Mon, 22 Nov 2010 16:08:57 +0000
Okay, I've verified that the page has loaded correctly (by running [webView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"] to output the HTML of the loaded webview and then comparing it with the page loaded by the Mac version to ensure that they're the same.)
I've come to the conclusion that the problem is that the Javascript is taking longer than 10 seconds to complete. This is a bit of a problem since the Javascript is sending user credentials to the server and the server takes a little over 10 seconds to service that request and send back (a rather large) packet of data - which then needs to be processed. On the Mac, this takes a little under 10 seconds - on the iPhone it wouldn't surprise me if it took rather longer.
So my question is this - how can I override this 10 second limit, if only to test my theory (i.e. even if that isn't permitted in a shipping app, can I do it for debug purposes)? Does anyone have any ideas for circumventing this problem (rewriting the HTML of the page is not, sadly, an option). Or is it a case that there are some things that simply can't be done on iOS?
On 18 Nov 2010, at 15:53, Conrad Shultz wrote:
> What do you mean by "load the page in a separate thread?" My understanding is that UIKit in general, and UIWebView in particular, is very thread unsafe.
>
> Have you tested this all on a single thread? I know that you say it's working, but threading issues can lead to bizarre breakage.
>
> -Conrad
>
> On Nov 18, 2010, at 0:19, Geoffrey Holden <email@hidden> wrote:
>
>> No - this isn't in a secondary thread. It does load the page in a separate thread (in order to ensure that the UI doesn't lock up), but the code isn't executed until the page has finished loading. With regard to the load thread, the code is identical to the code I used on the Mac - and I've been able to confirm that this part of the code is executing correctly, and that the page really has loaded correctly.
>>
>> Nice thought though.
>>
>>
>> On 17 Nov 2010, at 22:07, Conrad Shultz wrote:
>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> On 11/17/10 1:33 PM, Geoffrey Holden wrote:
>>>> void SendDelegateMessage(NSInvocation*): delegate (webViewDidLayout:)
>>>> failed to return after waiting 10 seconds. main run loop mode:
>>>> GSEventReceiveRunLoopMode
>>>>
>>>> I have got webViewDidFinishLoad (that's where this code is called) -
>>>> so it isn't that it's trying to run on nothing.
>>>>
>>>> If you have any ideas about what I could do to fix this, I'd be most
>>>> interested to hear them!
>>>
>>> Hmm. I haven't seen this myself, but are you by any chance trying to do
>>> this on a secondary thread?
>>>
>>> - --
>>> Conrad Shultz
>>>
>>> Synthetiq Solutions
>>> www.synthetiqsolutions.com
>>> -----BEGIN PGP SIGNATURE-----
>>> Version: GnuPG v1.4.7 (Darwin)
>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>>
>>> iD8DBQFM5FIuaOlrz5+0JdURApjsAJ4uPKnHEFVUJkiJJb7gtLx9dVMnDQCfSi9O
>>> gMRqrPoelphoQuTmbPt4esc=
>>> =mRgF
>>> -----END PGP SIGNATURE-----
>>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden