Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The way I do this is to make a NSObject class with a NSURLConnection in it and set a Property Tag on the class. Then you have the NSObject/NSURLConnection class with the connection return itself to the delegate when the download finishes. You have a method like the -(void)downloadFinished example below to handle the reply in the delegate. </p> <p>In the NSObject Class you use NSJsonSerialization to convert the NSDictionary to Json and append it to the NSURLConnection. </p> <p>I wish I could link you to the JsonHelper Class on Github however I have not uploaded it to Github yet :(. </p> <p>Example Request:</p> <pre><code>NSDictionary *post = [NSDictionary dictionaryWithObjectsAndKeys:@"Json_Value",@"Json_Key",nil]; JsonHelper *jsonHelper = [[JsonHelper alloc]initWithURL:@"http://mycoolwebservice.com" withDictionary:post withMethod:@"POST" showIndicator:NO withDelegate:self withCache:NO]; [jsonHelper setTag:1]; [jsonHelper connectionStart]; </code></pre> <p>Delegate Reply Example:</p> <pre><code>-(void)downloadFinished:(id)sender { if ([sender isKindOfClass:[JsonHelper class]]) { NSError *error = nil; JsonHelper *jsonHelper = (JsonHelper*)sender; NSData *data = [[NSData alloc]initWithData:jsonHelper.receivedData]; NSString *returnString = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding]; if (jsonHelper.tag == 0) { // Do Something } else if (jsonHelper.tag == 1) { // Do Something Else } } } </code></pre> <p>It should not be too difficult to write your own custom class to do more or less the same thing using this example. </p>
    singulars
    1. This table or related slice is empty.
    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. This table or related slice is empty.
    1. 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