Swift LinkedIn登录:获取公开个人资料URL

时间:2017-09-12 21:15:51

标签: ios swift sdk linkedin

我正在尝试使用LinkedIn SDK和Swift 3获取用户的个人资料网址。我有一个功能登录但我无法弄清楚如何检索我请求的配置文件URL数据。

self.linkedinHelper.requestURL("https://api.linkedin.com/v1/people/~:(public-profile-url)?format=json", requestType: LinkedinSwiftRequestGet, success: { (response) -> Void in

print("Request success with response: \(response)")

此代码打印成功,我可以看到配置文件URL。我无法弄清楚如何从response变量中提取URL。 response的类型为 LSResponse 。如何从public-profile-url变量中获取response数据?

谢谢!

1 个答案:

答案 0 :(得分:1)

您应该使用response的{​​{1}}属性来访问JSON格式的数据。根据{{​​3}},您应该访问名为jsonData的字典中的url密钥。

siteStandardProfileRequest