Note that there are some explanatory texts on larger screens.

plurals
  1. POJSON DELETE method in objective C is not working?
    text
    copied!<p>I have a with Json Delete method. I have surfed around the internet and got nothing.</p> <p>Here is the code i have tried for the Json Delete Method. It simply returns "Json value failed"</p> <pre><code>NSString *posturl=[NSString stringWithFormat:@"%@/spottings/%@/media/%@.json?auth_token=%@",_BASE_API_URL,[_spotting_id_array objectAtIndex:button.tag],[_ex_media_id_array objectAtIndex:button.tag],_ex_auth_token_str]; NSLog(@"posturl:%@",posturl); // Prepare string request NSURL *url=[NSURL URLWithString:[NSString stringWithFormat:@"%@",posturl]]; // Prepare URL request NSMutableURLRequest *request =[[[NSMutableURLRequest alloc] init] autorelease]; NSOperationQueue *queue = [[NSOperationQueue alloc] init]; // Set the URL to request [request setURL:url]; // Set the URL method [request setHTTPMethod:@"DELETE"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *urlData, NSError *error){ if ([urlData length] &gt;0 &amp;&amp; error == nil) { // Get JSON as a NSString from NSData response NSString *data=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding]; // parse the JSON response into an object // Here we're using NSArray since we're parsing an array of JSON status objects _results = [data JSONValue]; NSLog(@"_results:%@",_results); } else if ([urlData length] == 0 &amp;&amp; error == nil) { NSLog(@"Nothing was downloaded."); } else if (error != nil){ NSLog(@"Error = %@", error); } }]; </code></pre> <p>Error code :</p> <p>-JSONValue failed. Error trace is: ( "Error Domain=org.brautaset.JSON.ErrorDomain Code=10 \"Garbage after JSON\" UserInfo=0x8195240 {NSLocalizedDescription=Garbage after JSON}"</p>
 

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