Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>These are the essential (stripping out conditions I've made for my own use) lines that ended up satisfying my request to the web service. Thanks for the suggestions @8vius and @mattt !</p> <pre><code>- (IBAction)loginButtonPressed { NSURL *baseURL = [NSURL URLWithString:@"https://www.example.com/api/class"]; //build normal NSMutableURLRequest objects //make sure to setHTTPMethod to "POST". //from https://github.com/AFNetworking/AFNetworking AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:baseURL]; [httpClient defaultValueForHeader:@"Accept"]; NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: [usernameTextField text], kUsernameField, [passwordTextField text], kPasswordField, nil]; NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:@"https://www.example.com/api/class/function" parameters:params]; //Add your request object to an AFHTTPRequestOperation AFHTTPRequestOperation *operation = [[[AFHTTPRequestOperation alloc] initWithRequest:request] autorelease]; //"Why don't I get JSON / XML / Property List in my HTTP client callbacks?" //see: https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-FAQ //mattt's suggestion http://stackoverflow.com/a/9931815/1004227 - //-still didn't prevent me from receiving plist data //[httpClient registerHTTPOperationClass: // [AFPropertyListParameterEncoding class]]; [httpClient registerHTTPOperationClass:[AFHTTPRequestOperation class]]; [operation setCompletionBlockWithSuccess: ^(AFHTTPRequestOperation *operation, id responseObject) { NSString *response = [operation responseString]; NSLog(@"response: [%@]",response); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"error: %@", [operation error]); }]; //call start on your request operation [operation start]; [httpClient release]; } </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