Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BrodyMedia/LinkedinSwift

 
 

Repository files navigation

LinkedinSwift

CocoaPods

LinkedinSwift is a project for managing native LinkedIn SDK using Cocoapods

Linkedin Oauth Helper, depend on Linkedin Native App installed or not, using Linkdin IOS SDK or UIWebView to login, support Swift with iOS 7

Latest version 1.4 is based on LinkedIn SDK 1.0.4 and IOSLinkedinAPI for webview auth.

How to use

pod 'LinkedinSwift', '~> 1.4'

Check out Example project.

  • Setup configuration and helper instance.
let linkedinHelper = LinkedinSwiftHelper(configuration: LinkedinSwiftConfiguration(clientId: "77tn2ar7gq6lgv", clientSecret: "iqkDGYpWdhf7WKzA", state: "DLKDJF45DIWOERCM", permissions: ["r_basicprofile", "r_emailaddress"]))
  • Setup Linkedin SDK settings: instruction here
  • Setup redirect handler in AppDelegate
	func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
	
        // Linkedin sdk handle redirect
        if LinkedinSwiftHelper.shouldHandleUrl(url) {
            return LinkedinSwiftHelper.application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
        }
        
        return false
	}
  • Login:
		linkedinHelper.authorizeSuccess({ (lsToken) -> Void in
            //Login success lsToken
        }, error: { (error) -> Void in
            //Encounter error: error.localizedDescription
        }, cancel: { () -> Void in
            //User Cancelled!
        })
  • Fetch profile:
		linkedinHelper.requestURL("https://api.linkedin.com/v1/people/~?format=json", requestType: LinkedinSwiftRequestGet, success: { (response) -> Void in
            
            //Request success response
            
        }) { [unowned self] (error) -> Void in
                
            //Encounter error
        }

Example project screenshots:

Demo photo

Known issues

It turns out Linkedin 1.0.6 release note: Added Bitcode support. is a lie. (They secretly remove 1.0.6) You need to turn off Bitcode to make it work.

About

Linkedin IOS SDK for Swift with IOS 7

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 85.1%
  • C 8.1%
  • Swift 5.8%
  • Ruby 1.0%