【发布时间】:2015-11-19 12:37:40
【问题描述】:
如果我没记错的话,我不确定如何将PFUser 转换为[NSObject : AnyObject],我认为这是NSDictionary?
这是我正在使用的代码,但在最后一行出现错误。我对 Swift 很陌生,所以仍在尝试弄清楚所有这些类型转换的东西。
@IBAction func joinLobby(sender: AnyObject) {
if let currentUser = PFUser.currentUser() {
let channel = currentUser["language"] as! String
self.appDelegate.client?.unsubscribeFromPresenceChannels([channel])
self.appDelegate.client?.subscribeToChannels([channel], withPresence: true, clientState: PFUser.currentUser() as [NSObject : AnyObject])
}
}
错误:“无法将类型“PFUser?”的值转换为类型“[NSObject : AnyObject]”
【问题讨论】:
标签: ios swift parse-platform pubnub