gpt4 book ai didi

ios - 无法使用类型为 'performSelector' 的参数列表调用 '(String)'

转载 作者:搜寻专家 更新时间:2023-11-01 07:22:49 26 4
gpt4 key购买 nike

我正在使用 xcode 8 beta 并遇到以下错误并且无法解决。

无法使用“(String)”类型的参数列表调用“performSelector

func webView(WebViewNews: UIWebView!, shouldStartLoadWithRequest request: NSURLRequest!, navigationType: UIWebViewNavigationType) -> Bool {

if request.URL!.absoluteString.hasPrefix("ios:") {
// Call the given selector
self.performSelector("webToNativeCall")
// Cancel the location change
return false
}
return true
}

最佳答案

performSelector 已重命名为 perform(_ aSelector:):

class SomeClass: NSObject {

func webToNativeCall() {
// ...
}

func someFunc() {
self.perform(#selector(webToNativeCall))
}
}

关于ios - 无法使用类型为 'performSelector' 的参数列表调用 '(String)',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37810051/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com