WebView可可重载网页

发布于 2024-12-07 09:48:11 字数 138 浏览 1 评论 0原文

我使用 WebView 创建了一个 mac 应用程序。但问题是 webView 正在重新加载,

[webView mainFrameUrl] == newURL

为什么会出现这个问题?如何解决。

I have created a mac application using the WebView. But issue is that webView is reloading when

[webView mainFrameUrl] == newURL

why this problem is happening?? how to solve it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

隔岸观火 2024-12-14 09:48:11

切勿将字符串与 == 进行比较。您始终使用 NSString 的 isEqualToString: 方法来检查两个字符串是否相等。


[[webView mainFrameURL] isEqualToString: newURL]

Never compare strings with == You always use NSString's isEqualToString: method to check if the 2 strings are equal.


[[webView mainFrameURL] isEqualToString: newURL]
琴流音 2024-12-14 09:48:11

除了 theAmateurProgrammer 的答案是正确的这一事实之外,如果它没有解决您的问题(因为您没有接受它),我想给您另一条建议。

不要频繁调用mainFrameUrl。调用一次并将其存储在委托方法中的另一个变量中 - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame

Besides the fact that the answer of theAmateurProgrammer is the correct one I want to give you another suggestion if it didn't solve your problem (since you didn't accept it).

Don't call mainFrameUrl frequently. Call it once and store it in another variable in the delegate method - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文