When the server gives the response JSON the webviewdidfinishload method is not get called and I did'nt know how to read this steam from the server. For reference see screenshot:
http://www.flickr.com/photos/97186141#N05/9388886673/
Related
Am following the "Streaming HTTP Response" documentation of Play2! framework which describes how a file or stream could be sent as chunked responses. The http-action code I wrote after reading this is very simple -
Ok.chunked(
Enumerator.fromStream(istream).andThen(Enumerator.eof)
)
With this code everytime I refresh the URL the data in the stream gets downloaded as a file by the browser. Instead of downloading as a file I want the stream content to shown inline in the browser as text. The File example on the documentation page describes how one could do this with files... but looking at the APIs I dont see an inline option with streams. So is it possible to show stream data inline with chunked responses everytime I refresh the browser? If my expectation is invalid then a little explanation of why-so will be very welcome.
From my comment: You should set a content-type supported by your browser (like text/plain or text/xml) when sending the response, otherwise you're just sending bytes and the browser doesn't "know" it can display it.
Update: adding the exact code that solved the issue:
Ok.chunked( Enumerator.fromStream(istream).andThen(Enumerator.eof) ).as("text/html")
When I try to post an object using RestKit I get the following error.
"Cannot send a request that is loading or loaded without resetting it first."
What does it mean?
How can I reset a request?
Without posting a code, it is hard to say where the error is, but:
This error occurs, when either _isLoading or _isLoaded is set to NO. You could try to reset your request before sending it using [myRequest reset];.
I'm looking for a solution for reading the http status code with a UIWebView.
I have found this page on the topic How do I get the last HTTP Status Code from a UIWebView? but i cannot use AsiHttpRequest in my case.
Si I was wondering if somebody have found a solution since 2009, and if something similar to NSLog(#"Status code = %#",[webView stringByEvaluatingJavaScriptFromString:#"document.status"]);
could possibly work.
Thanks,
I don't think you can get it from the UIWebView, but I think it would work to have the result of an HTTP request put into an NSString, then parse the status code out of the header part of that string, thing feed that string to a UIWebView.
See the NSURL Class Reference and the URL Loading Programming Guide.
A possible alternative would be to implement an HTTP proxy directly inside your App, then feed a localhost URL to UIWebView. Your proxy would just make an HTTP connection with the web server and sit passively by while UIWebView drives the HTTP protocol. You then snoop on the incoming data before passing it on to UIWebView from your proxy. That would avoid the need to buffer the whole page in an NSString before feeding it to your UIWebView.
We have a http live streaming running on our iOS app. We want to get thumbnail images every 1 minute. I tried using MPMoviePlayerController methods
thumbnailImageAtTime:timeOption:
and
requestThumbnailImagesAtTimes:timeOption:
But both these options return nil. The documentation doesn't say if these methods do not work for http live streaming. Any ideas what could be the issue?
Now documentation for this method says:
"This method is not not called when the source URL is an HTTP Live Streaming (HLS) content source. See HTTP Live Streaming Overview."
Try registering for MPMoviePlayerThumbnailImageRequestDidFinishNotification before calling this method and on getting notification check value of this key MPMoviePlayerThumbnailImageKey. In case image capture was successful value of this key will contain a valid UIImage for you to use.
On the iphone, when trying to play a broken url using MPMoviePlayerController the user gets an alertbox with the message "the server is not correctly configured".
Is there any way to change this to something more user-friendly? Alternatively, is there any way to get an error status from the player instead of getting this message?
Thanks in advance..
MPMoviePlayer provides two notifications for the case of a broken / invalid movie URL:
From MPMoviePlayer initWithContentURL:
To check for errors in URL loading, register for the MPMoviePlayerContentPreloadDidFinishNotification or
MPMoviePlayerPlaybackDidFinishNotification notifications.
On error, these notifications contain an NSError
object available using the #"error" key in the notification’s userInfo dictionary.
You should be able to hook to one oh these notifications and perform the needed actions
if a broken URL is about to be loaded.
Usually this error message means that the web server that's serving the file does not support HTTP byte ranges.
iPhone OS uses HTTP byte ranges for streaming audio and video content. This makes it possible to "scrub" forwards and backwards in the content without downloading the entire content first.
Once I've got this error when trying to play urlencoded url string. I removed urlencoding method call before ask MPMoviePlayerController to play url and everything ok.