开发者

WebView cocoa reloading webpage

开发者 https://www.devze.com 2023-04-09 14:51 出处:网络
I have created a mac application using the WebView. But issue is that webView is reloading when [webView mainFrameUrl] == newURL

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

[webView mainFrameUrl] == newURL
开发者_JAVA百科

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


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


[[webView mainFrameURL] isEqualToString: newURL]


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号