无法为 "then" 处理程序指定参数类型
Can't specify the type of parameter to "then" handler
如果我这样指定 then
处理程序的参数类型...
.then { (things: [Thing]) -> Void in
然后我得到错误...
Cannot convert value of type '[Thing] -> Void' to expected argument
type '(AnyObject) -> AnyPromise'
是否可以执行我正在尝试的操作,或者我是否需要在处理程序的主体中转换参数?
如果您查看 here,那么 Objective-C 代码显示将参数设置为 NSArray,至少不是任何对象。
.then(^(NSArray *fetchedKittens){
必须使用承诺的通用参数指定所需的类型。
public func MyAsyncFunction() -> Promise<[Thing]>
并且不需要将参数键入 then
处理程序。
.then { things -> Void in
如果我这样指定 then
处理程序的参数类型...
.then { (things: [Thing]) -> Void in
然后我得到错误...
Cannot convert value of type '[Thing] -> Void' to expected argument type '(AnyObject) -> AnyPromise'
是否可以执行我正在尝试的操作,或者我是否需要在处理程序的主体中转换参数?
如果您查看 here,那么 Objective-C 代码显示将参数设置为 NSArray,至少不是任何对象。
.then(^(NSArray *fetchedKittens){
必须使用承诺的通用参数指定所需的类型。
public func MyAsyncFunction() -> Promise<[Thing]>
并且不需要将参数键入 then
处理程序。
.then { things -> Void in