【发布时间】:2019-12-09 18:59:14
【问题描述】:
我想用linkedin 授权url 加载web 视图,但在加载之前没有创建url,说明它是nil 并且web 视图不显示任何特定页面。 这是传递给 URLRequest 的 url 字符串。 https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=*******&redirect_uri=****&state=linkedin1575812567&scope=r_liteprofile
下面提到的是代码。
let responseType = "code"
let state = "linkedin\(Int(NSDate().timeIntervalSince1970))"
var authorizationURL = "\(authorizationEndPoint)?"
authorizationURL += "response_type=\(responseType)&"
authorizationURL += "client_id=\(linkedInConfig.linkedInKey)&"
authorizationURL += "redirect_uri=\(linkedInConfig.redirectURL)&"
authorizationURL += "state=\(state)&"
authorizationURL += "scope=\(scope)"
print(authorizationURL)
let url = URL(string: authorizationURL)
let request = URLRequest(url: url!)
webView.load(request)
【问题讨论】:
-
您是否正确实现了 Web 视图委托?很难从您的代码中理解可能是什么问题。
-
我正确设置了navigationdelegate。但它什么也没做。