💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
# js调用ios方法 ## ios ~~~objectivec // js配置 WKUserContentController *userContentController = [[WKUserContentController alloc] init]; //需要JS调用iOS 原生的方法,都要添加到这里 [userContentController addScriptMessageHandler:self name:@"finishHandle"]; // WKWebView的配置 WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init]; configuration.userContentController = userContentController; // 显示WKWebView self.webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight-NavitionbarHeight) configuration:configuration]; self.webView.UIDelegate = self; // 设置WKUIDelegate代理 [self.view addSubview:self.webView]; ~~~ ## js ``` js window.webkit.messageHandlers.finishHandle.postMessage('哈哈'); ```