我收到错误请求失败:尝试在LInkedIn中发布错误请求(400)
以下是我的代码
-(IBAction)btnLinkedIdShareClicked:(id)sender{
NSString *stringRequest = [NSString stringWithFormat:@"https://api.linkedin.com/v1/people/~/shares?oauth2_access_token=%@&format=json",[[NSUserDefaults standardUserDefaults] valueForKey:LINKED_IN_ACCESS_TOKEN]];
//Request parameter on a dictionary (keys in camel case)
NSDictionary *update = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSDictionary alloc] initWithObjectsAndKeys: @"anyone",@"code",nil], @"visibility",
@"TEST", @"comment",[[NSDictionary alloc] initWithObjectsAndKeys:@"description share", @"description", @"link_url", @"submittedUrl", @"title share",@"title", @"image_url",@"submittedImageUrl",nil], @"content",nil];
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
AFJSONRequestSerializer *requestSerializer = [AFJSONRequestSerializer serializer];
[requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
manager.requestSerializer = requestSerializer;
[manager POST:stringRequest parameters:update success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"result: %@", responseObject);
//completionBlock(YES, responseObject, nil);
NSLog(@"Yes");
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"%@",[error localizedDescription]);
NSLog(@"No");
}];
}
先谢谢,解决此问题的任何解决方案......?