我使用以下代码发送消息,使用链接的API
连接到我的链接NSString *xml;
xml=[NSString stringWithFormat:@"<?xml version='1.0' encoding='UTF-8'?> <mailbox-item> <recipients> <recipient> <person path='/people/~'/> </recipient> <recipient> <person path=\"/people/%@\" /> </recipient> </recipients> <subject>Congratulations on your new position.</subject> <body>You are certainly the best person for the job!</body> </mailbox-item>",idProfileRequest];
NSLog(@"xml %@",xml);
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://api.linkedin.com/v1/people/~/mailbox"]];
[activityIndicator startAnimating];
OAMutableURLRequest *request = [[OAMutableURLRequest alloc]initWithURL:url consumer:ApplicationDelegate.consumer token:ApplicationDelegate.accessToken callback:nil signatureProvider:nil];
NSData *myRequestData = [xml dataUsingEncoding:NSUTF8StringEncoding];
[ request setHTTPBody: myRequestData ];
[request setHTTPMethod:@"POST"];
//[request setValue:@"json" forHTTPHeaderField:@"x-li-format"];
OADataFetcher *dataFetcher = [[OADataFetcher alloc]init];
[dataFetcher fetchDataWithRequest:request delegate:self didFinishSelector:@selector(dataPost:didFinish:) didFailSelector:@selector(dataPost:didFail:)];
我正在使用synedra LinkedIn-OAuth-Sample-Client OAuth库。
我对OAuth签名也有同样的问题。
401 1385620251922 1PLI8KSALM 0 [未授权]。非统组织:x19azkkc5f2p | 21d8df03-7529-41c5-af85-81d8a6f3accb | * 01 | * 01:1385620251:WFDMNR7UwlJcEK8inflitVvX + 0M =