Hello Reader's,
I m using IOSLinkedinAPI to Share Video link to LinkedIn. But i m giving option to share picture URL , links and text post to LinkedIn.
- Install AFNetworking using pods.
- Download IOSLinkedinAPI and drag-drop "IOSLinkedInAPI" folder to project.
- Get MyLinkedInManager and DataObjects class from this link.
MyLinkedInManager and DataObjects classes
- Create app on LinkedIn then Give clientId and clientSecurity of app in MyLinkedInManager .
- Give UIAlertViewDelegate to your view controller.
- Add button to share post to linkedin :-
- (IBAction)shareToLinkedIn:(id)sender {
[[MyLinkedInManager sharedManager] setLoginCompleted:^(id details) {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Share to LinkedIn" message:@"Post Status :" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Share", nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
alert.delegate = self;
[alert show];
}];
if (![[DataObjects sharedDataObjects]accessTokenForLinkedIn]) {
[[MyLinkedInManager sharedManager]login];
}
else
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Share to LinkedIn" message:@"Post Status :" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Share", nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
alert.delegate = self;
[alert show];
}
}
#pragma mark AlertView Delegate Method
- (void)alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)buttoIndex
{
if (buttoIndex == 1) {
NSString * poststr = [alert textFieldAtIndex:0].text;
[[MyLinkedInManager sharedManager]sharetoLinkedIn:@"title" desc:@"description" path:@"https://c1.staticflickr.com/5/4022/4438173242_f78c3ea7fe.jpg" imagePath:@"https://c1.staticflickr.com/5/4022/4438173242_f78c3ea7fe.jpg" postString:poststr];
}
}
and now link shareToLinkedIn action to button in storyboard or xib file
and share .
1 Comment(s)