There should be a function to set the WKWebview in focus. Because if the javascript set the focus to an input box, it will only work if you click first on the webview to make it the current focus.
Post
Replies
Boosts
Views
Activity
MacOS 12.5 problem is still there.
Some of our customers cannot use our app because webview will crash for them all the time.
WKWebview on macCatalyst is broken and Apple are not fixing it.
Ignore my comment above, it does not work at all.
Can't delete and cannot edit my previous post.
Problem
//Warning : 'contentEdgeInsets' was deprecated in iOS 15.0:
// This property is ignored when using UIButtonConfiguration
/*uiButton.contentEdgeInsets = UIEdgeInsets(top: 8.0, left: 8.0, bottom: 8.0,right: 8.0 )
Solution
uiButton.configuration!.contentInsets = NSDirectionalEdgeInsets(top: 8.0, leading: 8.0, bottom: 8.0, trailing: 8.0)
Apple has finally given access to "uiButton.configuration!.contentInsets" in their latest Xcode update.
It now woks on iOS and macCatalyst.
I opened a ticket with Apple and they told me that the problem was indeed in the Safari engine and this problem is OS level, it has nothing to do with our app. I did as they told me and opened another ticket on somewhere else. I explained the crash in details with multiple crash dump. The problem has appeared in macOS Monterey, it was not there previously. macOS 12.4 does not solve the problem. If you want to see my problem look for :
"Mac Catalyst WKWebview random crash since Monterey"
macOS 12.4 problem is still there.
The problem is still there on macOS Monterey 12.3.1
Not everyone has that problem, I never had it myself on my 2 Macs. I would say 1 in a 10 or 1 in 100? We have 2 000 people using our app every day and I receive 1-2 call per week.
mackhag, you are our saviour, your solution is elegant, brilliant and simple.
Now please fix the world.
I would recommend that you put that in the code so as to not interfere with the iPad and iPhone version, because this problem does not exist on iOS.
#if targetEnvironment(macCatalyst)
//Put the mackhag fix here
#endif
Yes my Printing is allowed in app sandbox.
No, it is still there.
Do you also have this problem? https://developer.apple.com/forums/thread/698038
The exact same code for iOS and macOS because Catalyst.
Using the keyboard to paste on my iPad does work correctly, but it paste twice on my Mac.
I am talking about pasting text inside and input box in a web page running on WKWebview.
urlRequest.httpShouldHandleCookies control also the absorbtion of set-cookie, I thought it was taking the cookies from the WKWebview. My mistake, I will go hide under a rock now to hide my shame. This whole post should be deleted since it is useless.
I tested further with a tool to see the https traffic (Charles).
I can do this when I start the app
urlRequest.httpShouldHandleCookies = true //Always inject cookies
Or I can do this when I start the app
urlRequest.httpShouldHandleCookies = false //Never inject cookies
But if I change it on the fly, as soon as it is set to false, even if I set it to true later, it will never inject the cookies.
urlRequest.httpShouldHandleCookies = isSendCookies //Never inject cookies
It is now working, but everything else stop working (I am not the only one reporting that).
Every parameters of UIButton will be ignored if you use Configuration.
Also Configuration is too limited compared to good old button.
Many features missing like image for when it is pressed.
I will let Apple clean this mess before desecrating my code.
Now it is working on macOS 12.0
Problem is as soon as you use anything from Configuration, everything else stop working.
There is obviously a conflict in that SDK.
2 mutually exclusive things in the same UIButton.
Also if I use configuration to set image, there is only 1 image instead of the 2 that you could set on the good old UIButton.
I will wait for Apple to make their mind about where the are going. I will let the messy storm pass.