【发布时间】:2015-09-11 04:45:21
【问题描述】:
我正在尝试使用Swift JWT pod 来解码JWT 令牌。
// Get and decode the response
var response = NSURLConnection.sendSynchronousRequest(request, returningResponse: AutoreleasingUnsafeMutablePointer<NSURLResponse?>(), error: NSErrorPointer())
let responseContent = NSString(data:response!, encoding:NSUTF8StringEncoding)
let decoded = JWT.decode(responseContent! as String, .HS256(secret))
println(decoded.Success)
此代码给出错误:
'DecodeResult' does not have a member named 'Success'
看起来 DecodedResult 有一个 Enum: https://github.com/kylef/JSONWebToken.swift/blob/master/JWT/Decode.swift#L50
我如何才能访问那里的有效负载?
【问题讨论】: