LinkedinSwift
Linkedin IOS SDK for Swift from IOS 7
Install / Use
/learn @tonyli508/LinkedinSwiftREADME
LinkedinSwift
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
Latest version is based on LinkedIn SDK 1.0.7 and IOSLinkedinAPI for webview auth.
⚠️ Linkedin has turned down the support of The Mobile SDK link, hopefully they will solve this soon. For now only use web login.
let linkedinHelper = LinkedinSwiftHelper(configuration:
LinkedinSwiftConfiguration(
clientId: "77tn2ar7gq6lgv",
clientSecret: "iqkDGYpWdhf7WKzA",
state: "DLKDJF45DIWOERCM",
permissions: ["r_liteprofile", "r_emailaddress"]
),
nativeAppChecker: WebLoginOnly()
)
Try the example app as well.
Be aware of their upcoming changes for permissions as well, starting from 1st March, 2019, they may only supprot r_liteprofile permission instead of r_basicprofile. link
How to use
pod 'LinkedinSwift', '~> 1.8.1'
Check out Example project.
- Setup configuration and helper instance.
let linkedinHelper = LinkedinSwiftHelper(configuration:
LinkedinSwiftConfiguration(
clientId: "77tn2ar7gq6lgv",
clientSecret: "iqkDGYpWdhf7WKzA",
state: "DLKDJF45DIWOERCM",
permissions: ["r_liteprofile", "r_emailaddress"]
)
)
Or if you want to present in a different ViewController, using:
let linkedinHelper = LinkedinSwiftHelper(
configuration: LinkedinSwiftConfiguration(
clientId: "77tn2ar7gq6lgv",
clientSecret: "iqkDGYpWdhf7WKzA",
state: "DLKDJF45DIWOERCM",
permissions: ["r_basicprofile", "r_emailaddress"]
), webOAuthPresent: yourViewController
)
- 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
}
:warning: for iOS 9 and above use this instead:
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
// Linkedin sdk handle redirect
if LinkedinSwiftHelper.shouldHandle(url) {
return LinkedinSwiftHelper.application(app, open: url, sourceApplication: nil, annotation: nil)
}
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/v2/me",
requestType: LinkedinSwiftRequestGet,
success: { (response) -> Void in
//Request success response
}) { [unowned self] (error) -> Void in
//Encounter error
}
- Logout:
linkedinHelper.logout()
Example project screenshots:
<p align="left"> <img src="https://github.com/tonyli508/LinkedinSwift/blob/master/page_images/screenshot1.jpg" alt="Demo photo" width="280" height="500" /> </p>Known issues
~It seems Linkedin 1.0.7 messed up with Bitcode support. again. You need to turn off Bitcode to make it work.~
seems can turn on Bitcode now.
Related Skills
node-connect
354.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
