我正在尝试使用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
数据?
谢谢!
答案 0 :(得分:1)
您应该使用response
的{{1}}属性来访问JSON格式的数据。根据{{3}},您应该访问名为jsonData
的字典中的url
密钥。
siteStandardProfileRequest