Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin.ios 绑定问题:扩展类导致方法调用自身?_Xamarin.ios_Xamarin - Fatal编程技术网

Xamarin.ios 绑定问题:扩展类导致方法调用自身?

Xamarin.ios 绑定问题:扩展类导致方法调用自身?,xamarin.ios,xamarin,Xamarin.ios,Xamarin,我还有一个关于绑定的问题,它已经变得很难处理了,所以我想我应该从一个新的问题开始,这个问题包含了我目前所知道的最好的信息 我正试图在MonoTouch中的一个项目中使用Cordova。我一直在为科尔多瓦做装订 这里是我为Cordova 2.4.0类提供的绑定:注意,这不是一个完整的绑定,只是到目前为止我需要的部分 这是使用miguel.de.icaza的协议。这没有CDVViewController也采用的UIWebViewDelegate @interface CDVViewControlle

我还有一个关于绑定的问题,它已经变得很难处理了,所以我想我应该从一个新的问题开始,这个问题包含了我目前所知道的最好的信息

我正试图在MonoTouch中的一个项目中使用Cordova。我一直在为科尔多瓦做装订

这里是我为Cordova 2.4.0类提供的绑定:注意,这不是一个完整的绑定,只是到目前为止我需要的部分

这是使用miguel.de.icaza的协议。这没有CDVViewController也采用的UIWebViewDelegate

@interface CDVViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate>{
    @protected
    CDVCommandDelegateImpl* _commandDelegate;
    @protected
    CDVCommandQueue* _commandQueue; 
    NSString* _userAgent;
}
我在ShouldAutoRotateToInterfaceOrientation中放置了一个断点,当我沿着该方法前进时,当我到达base.ShouldAutoRotateToInterfaceOrientation时,它只跳回到该方法的开头,我的调用堆栈现在添加了Cordova.CDVViewController.ShouldAutoRotateToInterfaceOrientation,但是从这个方法可用的源代码来看,它从不试图调用自身或子类实现。相反,它在内部调用supportsOrientation:来检查数组是否支持此方向

知道supportsOrientation:最终被调用了,我也试着从ShouldAutoRotateToInterfaceOrientation调用它,但后来我在该方法中得到了奇怪的回调行为

如果我直接实例化CDVViewController,那么一切似乎都按预期工作,但我需要覆盖我的项目的一些方法。当我扩展CDVViewController时, 然后这种行为开始发生

我对此很困惑,我不知道我做错了什么,所以任何帮助都将不胜感激


根据Rolf的请求更新1,以下是生成的类。我希望这就是你想要的。由于篇幅的原因,我将其作为要点添加到这里

这个问题的解决方案,正如罗尔夫指出的那样,我在我的论点中包含了-e标志

如B触摸帮助中所述


所以这里的问题是,我在不知不觉中使用了一个标志,专门使类不可分类,然后试图对它们进行子类化

您能找到为绑定生成的代码并查看/发布它的外观吗?如果右键单击解决方案并选择查看所有文件,则生成的文件位于某个子目录中,该子目录中的某个位置无法准确记住其名称,但您不需要花费很长时间就能找到它。感谢您的回复。我在生成的DLL中找到了这些。我希望这能帮助您使用绑定项目还是手动使用btouch?我正在手动使用btouch,使用以下命令/Developer/MonoTouch/usr/bin/btouch-e Cordova.cs-s Enums.cs AssemblyInfo.cs-out:Cordova.dll-link with=libcordova.a,libcordova.a。你会推荐一个绑定项目吗?我用它作为一个起点来研究如何绑定东西。试着删除-e参数。
@interface CDVViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate>{
    @protected
    CDVCommandDelegateImpl* _commandDelegate;
    @protected
    CDVCommandQueue* _commandQueue; 
    NSString* _userAgent;
}
public class WebViewController : CDVViewController
{
    public override bool ShouldAutoRotateToInterfaceOrientation (MonoTouch.UIKit.UIInterfaceOrientation interfaceOrientation)
    {
        Console.WriteLine ("Enter ShouldAutoRotateToInterfaceOrientation");
        var output = base.ShouldAutoRotateToInterfaceOrientation;
        Console.WriteLine ("Leave ShouldAutoRotateToInterfaceOrientation");
        return output;
    }
}
-e  Generates smaller classes that cannot be subclassed (previously called 'external mode').