我有下面的Swift代码。
func beanManager(_ beanManager: PTDBeanManager!, didDiscover bean: PTDBean!, error: Error!) {
if (bean.name == "SOME_NAME") {
connectToBean(bean!)
bean.delegate = self
print("Connected to Bean")
} else {
print("Found a Bean not named SOME_NAME")
}
}
func connectToBean(_ bean: PTDBean) {
var error: NSError?
deviceManager.connect(to: bean, error: &error)
bean.delegate = self
}
Xcode给我一个错误
模糊地使用' connectToBean(_:错误:)'
不确定是什么原因造成的。
被调用的方法(用Obj-C编写的SDK)是:
-(void)connectToBean:(PTDBean*)bean error:(NSError**)error;
Xcode中自动完成期间显示的方法签名是:
deviceManager?.connect(to: PTDBean!, error:NSErrorPointer)
答案 0 :(得分:0)
不再有NSErrorPointer参数。请改用do {
try deviceManager?.connect(to: bean)
} catch {
// whatever
}
:
db.collection.aggregate([
{ $unwind: "$participants" },
{ $group : { _id : null, emails: { $push: "$participants.email" } } },
{ $project: {"_id":0, emails:1}}
])