Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Copying my answer from <a href="https://stackoverflow.com/q/8251175/918764">https://stackoverflow.com/q/8251175/918764</a> - you're most likely getting this message because of you're calling <code>getResponseString</code> on a request that has failed. You should make sure that you check if you got a response before calling this: one way I've found to test for total request failure (i.e. network/server down) is to check:</p> <pre><code>if (request.responseStatusCode == 0) { // the request failed entirely } else { // you at least got a HTTP response } </code></pre> <hr> <p>This notably happens if you call <code>[asiHttpRequest getResponseString]</code> before a valid response has been returned and the request encoding has been set (i.e. couldn't connect to server).</p> <p>The easiest way to workaround this warning is by editing the <code>ASIHTTPRequest</code> class, remove the <code>@synthesize responseEncoding</code> and adding a simple custom getter/setter so you can return the default encoding if the response encoding isn't set:</p> <pre><code>- (NSStringEncoding) responseEncoding { return responseEncoding || self.defaultResponseEncoding; } - (void) setResponseEncoding:(NSStringEncoding)_responseEncoding { responseEncoding = _responseEncoding; } </code></pre> <p>There's also a more specific workaround for the <code>getResponseString</code> method, which I think is the only place that uses the encoding without checking for a value - since the encoding should be set for any non-zero length response:</p> <pre><code>- (NSString *)responseString { NSData *data = [self responseData]; if (!data) { return nil; } // --- INSERT THIS BLOCK --- // If the 'data' is present but empty, return a simple empty string if (data.length == 0) { return @""; } //assert(self.responseEncoding); // if you're into runtime asserts, uncomment this // --- END OF BLOCK TO INSERT --- return [[[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:[self responseEncoding]] autorelease]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload