WK_API_ENABLED, PROTOCOLS are left undefined it seems? It matters if using delegates, e.g. WKWebView
Inspecting WKNavigationDelegate.inc it appears all the important definitions for delegates are not getting compiled in because neither WK_API_ENABLED nor PROTOCOLS are defined?
It is causing me headache since I can not get those things working. See this example:
So first I had
Tmsdv_cocoanative_WebBrowserCocoaWKWebViewDelegate_Navigation = objcclass(NSObject)
private
FBrowserCtrlRef: TmsdvWebBrowserCocoaWKWebView;
public
// need implement
end;
FDelegate_Cocoa_Navigation := Tmsdv_cocoanative_WebBrowserCocoaWKWebViewDelegate_Navigation.alloc.init;
FDelegate_Cocoa_Navigation.FBrowserCtrlRef := Self;
FWebView_CocoaWKWebView.setNavigationDelegate(FDelegate_Cocoa_Navigation);
This gives error
Error: Incompatible type for arg no. 1: Got "Tmsdv_cocoanative_WebBrowserCocoaWKWebViewDelegate_Navigation", expected "WKNavigationDelegateProtocol"
Now this seems like a great error and easy fix
Tmsdv_cocoanative_WebBrowserCocoaWKWebViewDelegate_Navigation = objcclass(NSObject, WKNavigationDelegateProtocol)
private
FBrowserCtrlRef: TmsdvWebBrowserCocoaWKWebView;
public
// need implement
end;
But this will throw another error
Error: Identifier not found "WKNavigationDelegateProtocol"
.... Now I have added all units I could think of, but it won't help and the reason seems to be:
fpcsrc/packages/cocoaint/src/webkit/WebKit.pas
includes
fpcsrc/packages/cocoaint/src/webkit/src/Sources.inc
includes
fpcsrc/packages/cocoaint/src/webkit/src/webkit/WKNavigationDelegate.inc
But in this unit the WKNavigationDelegateProtocol does not get compiled in because these are not defined "WK_API_ENABLED, PROTOCOLS"
I am trying to understand how Lazarus one place can recognize the type, but then not recognize the type if I use it. Anyhow, I tried a "hack" defining the beforementioned defines them and then *including* the *WKNavigationDelegate.inc* file myself, but, well I did not get it working.