ios - 无法调用非函数类型的值 '((AnyClass) -> Bool)!'

标签 ios swift3

这是我的代码。

    let myDeepLinkAction: UAAction = UAAction(block: {(args:UAActionArguments, handler:UAActionCompletionHandler) -> Void in
                            handler(UAActionResult.empty())
                            }, acceptingArguments: {(arguments: UAActionArguments) in

                                if arguments.situation == UASituation.backgroundPush {

                                    return true
                                }
                                return ((arguments.value! as AnyObject).isKind(of: NSString) || (arguments.value! as AnyObject).isKind(of: URL))

                        })

swift 版本转换2.2 到3.0 后出现类型错误,请尽可能给我解决方案。

最佳答案

我找到了解决办法,很简单

 let myDeepLinkAction: UAAction = UAAction(block: {(args:UAActionArguments, handler:UAActionCompletionHandler) -> Void in
                        handler(UAActionResult.empty())
                        }, acceptingArguments: {(arguments: UAActionArguments) in

                            if arguments.situation == UASituation.backgroundPush {

                                return true
                            }
                            return (arguments.value! is NSString || arguments.value! is URL)

                    })

return (arguments.value! is NSString || arguments.value! is URL)

关于ios - 无法调用非函数类型的值 '((AnyClass) -> Bool)!',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41161294/

相关文章:

swift - 无法调用非函数类型的值 'HTTPURLResponse?' Alamofire 4,Swift 3

iOS Rich Push notifications with Xcode, Swift3 但无法获取图像

ios - 如何将 ImageView 及其属性从一个 View Controller 传递到另一个 View Controller ?

ios - 请在您的 Podfile 中为此目标指定一个平台?

html - 我可以在 IOS 5 的一个 UIWebView 中有两种不同的样式吗

Swift3,如何在字典中添加 AnyObject?

ios - MailChimp中的电子邮件,名称和自定义属性(快速3)

ios - 旋转 90 度更改图像大小和裁剪 - Swift 3

iOS - 如何预定义 TextView 行高

ios - 如何从不同的目标访问数组(KeyboardViewController)