0

如果我这样指定then处理程序的参数类型...

.then { (things: [Thing]) -> Void in

然后我得到错误...

无法将“[Thing] -> Void”类型的值转换为预期的参数类型“(AnyObject) -> AnyPromise”

是否可以做我正在尝试的事情,或者我是否需要在处理程序的主体中强制转换参数?

如果你看这里,那么 Objective-C 代码显示将参数设置为 NSArray,至少不是任何对象。

.then(^(NSArray *fetchedKittens){
4

1 回答 1

1

必须使用 promise 的泛型参数指定所需的类型。

public func MyAsyncFunction() -> Promise<[Thing]>

并且没有必要将参数输入到then处理程序。

.then { things -> Void in
于 2015-10-31T01:17:10.110 回答