Reputation: 9234
I'm trying to build a xamarin app that utilizes the Cordova library. I've been working on my own binding for the components of the library I need, and so far, it has been working well.
Today I ran into an interesting problem though. I was trying to override the webView: shouldStartLoadWithRequest:
method on the CDVViewContainer
available here.
I've looked at the Xamarin Binding Guide, and the Xamarin Advanced Binding guide. Both of these note that Protocols are Analogous to interfaces, and as is shown in the Advanced binding guide
@interface UITextField : UIControl <UITextInput> {
}
would translate into
[BaseType (typeof (UIControl))]
interface UITextField : UITextInput {
}
Based on this, I translated
@interface CDVViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate>{
}
into
[BaseType (typeof (UIViewController))]
interface CDVViewController : UIWebViewDelegate {
}
But when I attempt to make my binding library, I get
Cordova.cs(26,39): error CS0527L Type `MonoTouch.UIKit.UIWebViewDelegate' in interface list is not an interface.
I checked the Apple Specifications, and this is in fact a Protocol. Can anyone help me figure out what I'm doing wrong?
Upvotes: 3
Views: 1660
Reputation: 32694
This is a limitation on the tool. You can only use that syntax to adopt protocols when you include your own definition for it. It does not work when adopting protocols that have been defined in an external definition.
Upvotes: 5