Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 如何在PromiseKit中设置(履行:)时?_Swift_Promisekit - Fatal编程技术网

Swift 如何在PromiseKit中设置(履行:)时?

Swift 如何在PromiseKit中设置(履行:)时?,swift,promisekit,Swift,Promisekit,我设置了一个函数来返回一个承诺。我想在PromiseKit的功能中使用这个函数,但每当我尝试这样做时,就会出现一个错误。下面是返回承诺的函数: 但是,我得到一个错误,当参数列表类型为“(已实现:Promise)”时,xcode无法“调用”。我不知道如何解决这个问题,因为我认为我已经正确设置了它。当需要承诺时,我会给它一个承诺,所以我不确定该怎么做。尝试如下: when(fulfilled: [linkQueryy()] as! [Promise<Any>]).then { _ in

我设置了一个函数来返回一个
承诺
。我想在PromiseKit的
功能中使用这个函数,但每当我尝试这样做时,就会出现一个错误。下面是返回
承诺的函数:

但是,我得到一个错误,当参数列表类型为“(已实现:
Promise
)”时,xcode无法“调用”。我不知道如何解决这个问题,因为我认为我已经正确设置了它。当
需要承诺时,我会给它一个承诺,所以我不确定该怎么做。

尝试如下:

when(fulfilled: [linkQueryy()] as! [Promise<Any>]).then { _ in
    // do more asynch stuff
}
firstly {
    linkQueryy()
}.then { _ -> Void in
    // do more asynch stuff
}.catch { _ in
    // error!
}
什么是
linkQueryy()
when(fulfilled: [linkQueryy()] as! [Promise<Any>]).then { _ in
    // do more asynch stuff
}
firstly {
    linkQueryy()
}.then { _ -> Void in
    // do more asynch stuff
}.catch { _ in
    // error!
}