Latest 1.0.9
Homepage https://github.com/ahmetkgunay/LinkedinIOSHelper
License MIT
Platforms ios 6.0, requires ARC
Authors

Version
License
Platform

Twitter: @ahmtgny


Usage

Usage is simple, just import "LinkedInHelper.h" to your controller where you want to use this library:

If you want to login user with LinkedIn Api, so you can easily fetch your informations like below:


#import "LinkedInHelper.h"

@implementation ViewController

- (void)fetchUserInformations {        

    LinkedInHelper *linkedIn = [LinkedInHelper sharedInstance];

    linkedIn.cancelButtonText = @"Close"; // Or any other language But Default is Close

    NSArray *permissions = @[@(BasicProfile),
                            @(EmailAddress),
                            @(Share),
                            @(CompanyAdmin)];

    linkedIn.showActivityIndicator = YES;

#warning - Your LinkedIn App ClientId - ClientSecret - RedirectUrl

    [linkedIn requestMeWithSenderViewController:self
                                       clientId:@""         // Your App Client Id
                                   clientSecret:@""         // Your App Client Secret
                                    redirectUrl:@""         // Your App Redirect Url
                                    permissions:permissions
                                          state:@""               // Your client state
                                successUserInfo:^(NSDictionary *userInfo) {
                                    // Whole User Info
                                    NSLog(@"user Info : %@", userInfo);
                                }
                                failUserInfoBlock:^(NSError *error) {
                                    NSLog(@"error : %@", error.userInfo.description);
                                }
    ];
}

@end

You can check if LinkedIn Access Token is still valid like below:


- (BOOL)isLinkedInAccessTokenValid {
    return [LinkedInHelper sharedInstance].isValidToken;
}

You can fetch user Informations automatically without getting authorization code again via web view.
This will automatically fetch use informations thanks to valid access token

-  (void)getUserInfo {

    LinkedInHelper *linkedIn = [LinkedInHelper sharedInstance];

    // If user has already connected via linkedin in and access token is still valid then
    // No need to fetch authorizationCode and then accessToken again!

    #warning - To fetch user info  automatically without getting authorization code, accessToken must be still valid

    if (linkedIn.isValidToken) {

        // So Fetch member info by elderyly access token
        [linkedIn autoFetchUserInfoWithSuccess:^(NSDictionary *userInfo) {
            // Whole User Info
            NSLog(@"user Info : %@", userInfo);
        } failUserInfo:^(NSError *error) {
            NSLog(@"error : %@", error.userInfo.description);
        }];
    }
}

For more information please check the Demo App.
I tried to do my best in code by writing well documentation.

Customization Navigation Bar Of Authorization ViewController

You can customize app-wide Linkedin Auth View Controller Navigation Bar as shown below

  • Appearence Support

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [[LinkedinAuthorizationNavBar appearance] setAuthTintColor:[UIColor redColor]];
    [[LinkedinAuthorizationNavBar appearance] setAuthBarIsTranslucent:TRUE];
    [[LinkedinAuthorizationNavBar appearance] setAuthBarTintColor:[UIColor lightGrayColor]];
    [[LinkedinAuthorizationNavBar appearance] setAuthTitle:@"Linkedin"];

    NSDictionary *titleAttributes = @{
    NSForegroundColorAttributeName:[UIColor blackColor],
    NSFontAttributeName:[UIFont boldSystemFontOfSize:16]
    };
    [[LinkedinAuthorizationNavBar appearance] setAuthBarTitleTextAttributes:titleAttributes];

    NSDictionary *cancelButtonAttr = @{
    NSForegroundColorAttributeName:[UIColor redColor],
    NSFontAttributeName:[UIFont boldSystemFontOfSize:14]
    };
    [[LinkedinAuthorizationNavBar appearance] setAuthCancelButtonTitleTextAttributes:cancelButtonAttr];

    return YES;
}

Requirements

This library requires a deployment target of iOS 6.0 or greater.

Installation

LinkedinIOSHelper is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'LinkedinIOSHelper', '~> 1.0.9'

Author

Ahmet Kazım Günay, [email protected]

License

LinkedinIOSHelper is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "LinkedinIOSHelper",
    "version": "1.0.9",
    "summary": "Library to easily fetch Member Information from LinkedIn API",
    "description": "Easy to use and not using any dependency. If you want to make Login with Linkedin, this library is absolutely for you.",
    "homepage": "https://github.com/ahmetkgunay/LinkedinIOSHelper",
    "license": "MIT",
    "authors": {
        "Ahmet Kazu0131m Guu0308nay": "[email protected]"
    },
    "source": {
        "git": "https://github.com/ahmetkgunay/LinkedinIOSHelper.git",
        "tag": "1.0.9"
    },
    "social_media_url": "https://twitter.com/ahmtgny",
    "platforms": {
        "ios": "6.0"
    },
    "requires_arc": true,
    "source_files": "LinkedinIOSHelper/**/*.{h,m}"
}

Pin It on Pinterest

Share This