iphone - How to fetch LinkedIn connections/Friends/Contacts in iOS SDK? -
i want fetch friends linkedin profile. please suggest me tutorial.
my code :
nsurl *url = [nsurl urlwithstring:@"http://api.linkedin.com/v1/people/~/connections:(id,first-name,last-name,email-address,picture-url,positions)"]; oamutableurlrequest *request = [[oamutableurlrequest alloc] initwithurl:url consumer:self.oauthloginview.consumer token:self.oauthloginview.accesstoken callback:nil signatureprovider:nil]; [request setvalue:@"json" forhttpheaderfield:@"x-li-format"]; oadatafetcher *fetcher = [[oadatafetcher alloc] init]; [fetcher fetchdatawithrequest:request delegate:self didfinishselector:@selector(profileapicallresult:didfinish:) didfailselector:@selector(profileapicallresult:didfail:)];
you can use connections:for request part see this.
- (void)connectionsapicallresult:(loaserviceticket *)ticket didfinish:(nsdata *)data { nsstring *responsebody = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding]; nslog(@"connectionsapicallresult====%@",responsebody); [responsebody release]; } - (void)connectionsapicallresult:(loaserviceticket *)ticket didfail:(nserror *)error { nslog(@"%@",[error description]); } -(void)getconnectionscall { nsurl *url = [nsurl urlwithstring:@"http://api.linkedin.com/v1/people/~/connections:(headline,first-name,last-name,picture-url,id)"]; loamutableurlrequest *request = [[loamutableurlrequest alloc] initwithurl:url consumer:self.consumer token:testaccesstoken callback:nil signatureprovider:nil]; [request setvalue:@"json" forhttpheaderfield:@"x-li-format"]; loadatafetcher *fetcher = [[[loadatafetcher alloc] init] autorelease]; [fetcher fetchdatawithrequest:request delegate:self didfinishselector:@selector(requesttokenresult:didfinish:) didfailselector:@selector(requesttokenresult:didfail:)]; }
Comments
Post a Comment