WebView可可重载网页
我使用 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技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
切勿将字符串与
==
进行比较。您始终使用 NSString 的isEqualToString:
方法来检查两个字符串是否相等。Never compare strings with
==
You always use NSString'sisEqualToString:
method to check if the 2 strings are equal.除了 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