gpt4 book ai didi

ios - PFObject 没有成员 objectforkey

转载 作者:行者123 更新时间:2023-11-30 13:47:52 25 4
gpt4 key购买 nike

这是我的代码:

override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)

state = .DefaultMode

// fill the cache of a user's followees
ParseHelper.getFollowingUsersForUser(PFUser.currentUser()!) { (results: [PFObject]?, error: NSError?) -> Void in
let relations = results
// use map to extract the User from a Follow object
self.followingUsers = relations.map {
$0.objectForKey(ParseHelper.ParseFollowToUser) as! PFUser
}
}
}

我的错误:

Value of type '[PFObject]' has no member 'objectForKey'

最佳答案

我猜是因为 [PFObjects] 数组是可选的并且尚未解包。

if let relations = results {
// use map to extract the User from a Follow object
self.followingUsers = relations.map {
$0.objectForKey(ParseHelper.ParseFollowToUser) as! PFUser
}
}

关于ios - PFObject 没有成员 objectforkey,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34700434/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com