Thursday, April 25, 2019

WebKit warning and crash

I found an interesting bug in my WebView code today. If you are a Mac developer that always writes programs on the latest OS with WKWebview you will probably never run into this problem. But if you want to keep your code running on older Mac systems read on.

So every time I compiled my App I was getting a strange error below:

*** WARNING: Method convertPointToBase: in class NSView is deprecated on 10.7 and later. It should not be used in new applications.

None of the posts on the internet seemed to have an answer to the warning above. The most common posts about it are below:

https://stackoverflow.com/questions/28124804/warning-convertpointtobase-is-deprecated

https://forums.developer.apple.com/thread/46889

https://forum.xojo.com/41162-method-convertpointtobase-is-deprecated/0

Please note that I use a MainMenu.xib file so if you using some other method it may not work. So how do you fix the error? I will walk you through the steps below:
1) Find the window in the XIB file.
2) Click the arrow next to the window object and select your view like below:


3) In the rightmost panel for the view select the rightmost button at the top.
4) At the top of the panel there should be a checkbox that has the name of your View with the title Core Animation Layer above it.
5) Uncheck the View’s checkbox like in the image below:


The next time you compile your App the warning should disappear. So what is happening? From what I understand the Core Animation Layer is using old “deprecated” code. The CALayer has a history of not being up to date. From what I remember OS 10.7 Lion’s CALayer was still a 32 bit framework even though Apple had updated all of their frameworks to 64 bit. It could also be because WKWebView is the preferred way and WebView is deprecated. I hope this helps if you come across this problem like me.

No comments:

Post a Comment