我在尝试将PFQuery的结果转换为正确的子类时遇到错误。
错误为swift_dynamicCastClassUnconditional
我的代码看起来像这样:
let resellerQuery = Reseller.query() // Reseller is a subclass of PFObject
resellerQuery.fromLocalDatastore()
resellerQuery.whereKey("name", equalTo: resellerName)
resellerQuery.getFirstObjectInBackgroundWithBlock({ (result: PFObject?, error) -> Void in
if (error == nil) {
let resellerObject = result as Reseller
}
})
我在创建resellerObject的行上收到错误。
let resellerObject = result as Reseller
你有什么想法吗?