大佬教程收集整理的这篇文章主要介绍了ios – 如何将应用程序中的Linkedin SDK集成到使用Swift进行登录和共享,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我很快乐,
我尝试在swift中转换此代码,但它不起作用.
Plz建议我如何在swift中转换下面的代码.
或者我如何整合Linkedin Sdk登录&使用swift通过我的应用分享..
enter code here [LISDKSessionManager createSessionWithAuth:permissions state:nil showGoToAppStoreDialog:YES successBlock:^(NSString *returnStatE){ NSLog(@"%s","success called!"); LISDKSession *session = [[LISDKSessionManager sharedInstance] session]; NSLog(@"Session : %@",session.description); [[LISDKAPIHelper sharedInstance] getrequest:@"https://api.linkedin.com/v1/people/~" success:^(LISDKAPIResponse *responsE) { NSData* data = [response.data dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary *DictResponse = [NSJSONserialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; NSString *authUsername = [NSString StringWithFormat: @"%@ %@",[DictResponse valueForKey: @"firstName"],[DictResponse valueForKey: @"lastName"]]; NSLog(@"Authenticated user name : %@",authUserName); [self.lblAuthenticatedUser setText: authUsername]; } error:^(LISDKAPIError *apiError) { NSLog(@"Error : %@",apiError); }]; } errorBlock:^(NSError *error) { NSLog(@"Error called : %@",error); }];
希望这可以帮助
@IBACtion func connectWithLinkedIn(sender: AnyObject) { let url = NSString(String:"https://api.linkedin.com/v1/people/~:(id,industry,firstName,lastName,emailAddress,headline,sumMary,publicProfileUrl,specialties,positions:(id,title,start-date,end-date,is-current,company:(id,name,type,size,ticker)),pictureUrls::(original),LOCATIOn:(Name))?format=json") let permissions: [AnyObject] = [LISDK_BASIC_PROFILE_PERMISSION,LISDK_EMAILADDRESS_PERMISSION] LISDKSessionManager.createSessionWithAuth(permissions,state: nil,showGoToAppStoreDialog: true,successBlock: { (success) -> () in if LISDKSessionManager.hasValidSession() { LISDKAPIHelper.sharedInstance().getrequest(url as String,success: { response in print(responsE) print("successfully signed in") dispatch_async(dispatch_get_main_queue(),{ () -> () in if let dataFromString = response.data.dataUsingEncoding(NSUTF8StringEncoding,allowLossyConversion: falsE) { let result = JSON(data: dataFromString) LISDKSessionManager.clearSession() //Do something with the response for example var picURL: String! for StringInArray in result["pictureUrls"]["values"]{ let value = StringInArray.1.stringvalue print(value) picURL = value } print(result["pictureUrls"]["values"].arrayvalue) print(result["specialties"].stringvalue) } }) },error: { error in LISDKAPIHelper.sharedInstance().cancelCalls() LISDKSessionManager.clearSession() print(error.localizedDescription) //Do something with the error }) } print("success called!") },errorBlock: { (error) -> () in print("%s","error called!") LISDKAPIHelper.sharedInstance().cancelCalls() LISDKSessionManager.clearSession() }) }
以上是大佬教程为你收集整理的ios – 如何将应用程序中的Linkedin SDK集成到使用Swift进行登录和共享全部内容,希望文章能够帮你解决ios – 如何将应用程序中的Linkedin SDK集成到使用Swift进行登录和共享所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。