Linkedin Mobile SDK for iOS - Callback Timeouts
I am using the new iOS SDK from Linkedin version 1.0.2 and am getting callback timeouts. The goal is to authenticate and then link the social account to an existing internal account or create a new internal user from the social information. Everything works, but not 100% of the time. Sometimes after 60 seconds the callback will time out. This happens with the installed connected app. Any ideas?
@IBAction func linkedin(sender: AnyObject) {
LISDKSessionManager.createSessionWithAuth([LISDK_BASIC_PROFILE_PERMISSION, LISDK_EMAILADDRESS_PERMISSION], state: nil, showGoToAppStoreDialog: true, successBlock: { (string) -> () in
if (LISDKSessionManager.hasValidSession()) {
LISDKAPIHelper.sharedInstance().getRequest("\(Constants.linkedinBaseURL)/people/~:(id,firstName,lastName,email-address)", success: { (response) -> () in
dispatch_async(dispatch_get_main_queue(), { () -> () in
if let dataFromString = response.data.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false) {
let result = JSON(data: dataFromString)
LISDKSessionManager.clearSession()
var socialMember = SocialMember()
socialMember.socialType = SocialType.linkedin
socialMember.id = result["id"].stringValue
socialMember.email = result["emailAddress"].stringValue
socialMember.firstName = result["firstName"].stringValue
socialMember.lastName = result["lastName"].stringValue
Loader.setOnView(self.view, withTitle: "Loading...", animated: true)
self.socialLink(socialMember, completion: { () -> () in
Loader.hideFromView(self.view, animated: true)
})
}
})
}, error: { (error) -> () in
LISDKAPIHelper.sharedInstance().cancelCalls()
LISDKSessionManager.clearSession()
println(error)
})
}
}, errorBlock: { (error) -> () in
LISDKAPIHelper.sharedInstance().cancelCalls()
LISDKSessionManager.clearSession()
println(error)
})
}
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
if (LISDKCallbackHandler.shouldHandleUrl(url)) {
return LISDKCallbackHandler.application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}
return false
}
Callback error after 60 seconds
2015-08-05 15: 24: 05.500 xxx [34640: 7245029] lisdksession manager openURL called !,
Error Domain = LISDKAuthError Code = 2 "Operation could not be completed. (LISDKAuthError error 2.)" UserInfo = 0x174a6a3c0 {errorDescription = The request timed out, originalDomain = LISDKNetworkUnavailableError, errorInfo = NETWORLE_UNAVAIL
source to share