在我的应用程序中具有表视图的视图控制器中,我有一个查询来获取用户正在参与的所有事件的数据。这很好用,但我也希望得到用户创建的所有事件。
第一个"如果让"语句工作正常,但第二个引发错误
Cannot invoke initializer of type 'PFObject' with an argument list of type (withoutDataWithClassName...)
有任何帮助吗?谢谢!
override func viewDidLoad() {
super.viewDidLoad()
if let events = PFUser.currentUser()?["eventsToAttend"] as? [String] {
self.eventsToAttend = [Event]()
for eventId in events {
if let event = PFObject(withoutDataWithClassName: "Event", objectId: eventId) as? Event {
self.eventsToAttend?.append(event)
}
}
}
if let eventsCreated = PFUser.currentUser()?["Events"] as? [String] {
self.eventsCreated = [Event]()
for eventCreated in eventsCreated {
if let eventC = PFObject(withoutDataWithClassName: "Event", objectId: eventsCreated) as? Event {
self.eventsCreated?.append(eventC)
}
}
}
}
答案 0 :(得分:0)
我注意到你有一个eventsCreated和一个self.eventsCreated。这可能与它有关吗?