Read all the data using NSConnection then load it into the UIWebView using loadData:MIMEType:textEncodingName:baseURL.
Read all the data using NSConnection, then load it into the UIWebView using -loadData:MIMEType:textEncodingName:baseURL:.
Would be nice, but I can't simply load a xx MB file just to find out its mime type. That's why I need to work with the response. – Yllier Jul 24 '09 at 20:36 You're going to load the xx MB file one way or the other (either with NSURLConnection or UIWebView; it's all you).
What are you going to do with the knowledge of its mime type before handing it off to UIWebView? Perhaps there's a more problem-specific (rather than solution-specific) part of the question that you've left out? – Rob Napier Jul 24 '09 at 20:41 thanks for trying to help.
I want to decide inside my webView:shouldStartLoadWithRequest:navigationType: delegate if I want to download from that URL or show it in webView (see if the MIME type is html/php or another type of file). The important part is that I need to analyze the request before webView:shouldStartLoadWithRequest:navigationType: is finished. So I need to find a way to put the webView delegate on hold till the response can be examined (without downloading all data, cause I want to ask the user if he wants to download a file) (like a real browser) – Yllier Jul 24 '09 at 20:47.
First, you really shouldn't be using synchronous methods for web data, the potential delays are bad. I would suggest that you make two calls: the first to find the MIME type, which cancels the connection as soon as you can determine it. The second when you want to download the full data.As this might be to load into a UIWebView, this doesn't seem unreasonable.
If you just need the headers, you can first make a HEAD request (instead of a GET). That will only return the headers, without any body. That may even be fast enough that you could consider doing it synchronously, though you'd obviously want to test that thoroughly.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.