Ancient Programming

What I encounter in my software part of life is in danger of being commented upon here

Version 2.0.0 of the IOSLinkedInAPI is available

Posted by Jacob von Eyben on January 30th, 2014

Just want people to know that they can grab the latest and greatest version (2.0.0) of the IOSLinkedInAPI

It is available as a cocoapod as well.

Changes:

  • Updated to use AFNetworking 2.x
  • persisting tokens between requests in NSUserDefaults
  • better/nicer presentation of authentication window on IPad
  • General bugfixing

One Response to “Version 2.0.0 of the IOSLinkedInAPI is available”

  1. linzh Says:

    thanks for your efforts on IOSLinkedInAPI!
    i used the sample in IOSLinkedInAPI for sending message to linkedin friends. i follow instructions written by linkedin, http://developer.linkedin.com/documents/messaging-between-connections-api
    but it stuck when POST JSON request, here’s my code snippet:

    // set the Content-Type header
    self.client.responseSerializer = [AFJSONResponseSerializer serializer];
    self.client.requestSerializer = [AFJSONRequestSerializer serializer];
    [self.client.requestSerializer setValue:[NSString stringWithFormat:@"application/json"] forHTTPHeaderField:@”Content-Type”];
    [self.client.requestSerializer setValue:[NSString stringWithFormat:@"json"] forHTTPHeaderField:@”x-li-format”];

    [self.client POST:[NSString stringWithFormat:@"http://api.linkedin.com/v1/people/~/mailbox"] parameters:tempDict success:^(AFHTTPRequestOperation *operation, NSDictionary *result) {

    NSLog(@”success send message, with response: %@”, result);

    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    NSLog(@”failed to send message: %@”, error);
    }];

    And here is error from AFNetworking:

    failed to send message: Error Domain=AFNetworkingErrorDomain Code=-1011 “Request failed: unauthorized (401)” UserInfo=0×8c99b00 {NSErrorFailingURLKey=http://api.linkedin.com/v1/people/~/mailbox, NSLocalizedDescription=Request failed: unauthorized (401), NSUnderlyingError=0×8b739a0 “Request failed: unacceptable content-type: text/xml”, AFNetworkingOperationFailingURLResponseErrorKey= { URL: http://api.linkedin.com/v1/people/~/mailbox } { status code: 401, headers {
    Connection = “keep-alive”;
    “Content-Encoding” = gzip;
    “Content-Type” = “text/xml;charset=UTF-8″;
    Date = “Tue, 04 Mar 2014 13:20:38 GMT”;
    Server = “Apache-Coyote/1.1″;
    “Transfer-Encoding” = Identity;
    Vary = “*”;
    “Www-Authenticate” = “OAuth realm=\”https://api.linkedin.com\”";
    “X-LI-UUID” = “8IGQTVpEWBMwa8ZXqisAAA==”;
    “X-Li-Fabric” = “PROD-ELA4″;
    “X-Li-Pop” = “PROD-ELA4″;
    “x-li-format” = xml;
    “x-li-request-id” = L7AJ5N2C8F;
    } }}

    in my code snippet, i explicitly set Content-Type header as “application/json”, however, the error output show that: Request failed with : unacceptable content-type: text/xml”,

    have u any ideas for this issue?

    thanks!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>