1

我正在研究 xcode 8 beta 并且遇到错误并且无法解决。

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

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
 }
4

1 回答 1

2

performSelector已更名perform(_ aSelector:)

class SomeClass: NSObject {

    func webToNativeCall() {
        // ...
    }

    func someFunc() {
        self.perform(#selector(webToNativeCall))
    }
}
于 2016-06-14T18:41:47.570 回答