Search code examples
objective-cmacoscocoawebkit

Cocoa Webkit WebPolicyDecisionListener wrong implementation


I am developing an application on OS X with Cocoa Webkit. I have implemented my custom WebPolicyDecisionListener but I got the fallowing error:

Class WebPolicyDecisionListener is implemented in both /System/Library/Frameworks/WebKit.framework/Versions/A/WebKit and /Users/cagryInside/Library/Developer/Xcode/DerivedData/MacKeep-aejgqnnxruvgutahmyngzygezfse/Build/Products/Debug/MacKeep.app/Contents/MacOS/MacKeep. One of the two will be used. Which one is undefined.

Here is my code:

WebPolicyDecisionListener* listener = [[WebPolicyDecisionListener alloc] init];
[[self webView] setPolicyDelegate:listener];

Thanks for any help.


Solution

  • WebPolicyDecisionListener is a protocol. Rather than instantiating it directly, you need to create your own class, declare conformance to WebPolicyDecisionListener, and implement the required methods.

    If you're unfamiliar with using protocols, see Programming with Objective-C: Working with Protocols.