C# Xamarin.Forms/iOS,得到了异常;你“不应该”在“这个方法”中“调用”基“;?

C# Xamarin.Forms/iOS,得到了异常;你“不应该”在“这个方法”中“调用”基“;?,c#,android,ios,xamarin,xamarin.ios,C#,Android,Ios,Xamarin,Xamarin.ios,我有一个Xamarin.Forms项目,并且已经实现了一个第三方服务,Android部分几乎是完美的,但是iOS部署不断抛出异常。我完全不知道这个异常,因为在代码中,我在调用的方法中得到了所有正确的返回值。所以,我想知道什么是“基地”,我应该检查哪个地方 例外情况如下: void Join_Clicked(object sender, System.EventArgs e) { String channelName = this.Room_Name_Entry.Text; if

我有一个Xamarin.Forms项目,并且已经实现了一个第三方服务,Android部分几乎是完美的,但是iOS部署不断抛出异常。我完全不知道这个异常,因为在代码中,我在调用的方法中得到了所有正确的返回值。所以,我想知道什么是“基地”,我应该检查哪个地方

例外情况如下:

void Join_Clicked(object sender, System.EventArgs e)
{
    String channelName = this.Room_Name_Entry.Text;
    if (channelName != null)
    {
        if (myEngine.AgoraJoinChannel(channelName) == 0)
        {
            this.VoiceStatus.Text = "You are in the channel!";
            this.VoiceStatus.IsVisible = true;
            this.Room_Join_Button.IsEnabled = false;
        }
        else
        {
            this.VoiceStatus.Text = "You are not in the channel!";
            this.VoiceStatus.IsVisible = true;
        }
    }
    else
    {
        this.VoiceStatus.Text = "Please set the room's name!";
        this.VoiceStatus.IsVisible = true;
    }
}

下面是引发异常的代码部分:

void Join_Clicked(object sender, System.EventArgs e)
{
    String channelName = this.Room_Name_Entry.Text;
    if (channelName != null)
    {
        if (myEngine.AgoraJoinChannel(channelName) == 0)
        {
            this.VoiceStatus.Text = "You are in the channel!";
            this.VoiceStatus.IsVisible = true;
            this.Room_Join_Button.IsEnabled = false;
        }
        else
        {
            this.VoiceStatus.Text = "You are not in the channel!";
            this.VoiceStatus.IsVisible = true;
        }
    }
    else
    {
        this.VoiceStatus.Text = "Please set the room's name!";
        this.VoiceStatus.IsVisible = true;
    }
}
以下是特定于平台的工具:

using System;
using DT.Xamarin.Agora;
using TabbedPageTest.iOS;

[assembly: Xamarin.Forms.Dependency(typeof(AgoraVoiceImplement_iOS))]
namespace TabbedPageTest.iOS
{
    public class AgoraVoiceImplement_iOS : IAgora
    {
        AgoraRtcEngineKit myEngine;
        AgoraRtcEngineDelegate myDelegate;

        public AgoraVoiceImplement_iOS()
        {
            myDelegate = new AgoraRtcEngineDelegate();
            myEngine = AgoraRtcEngineKit.SharedEngineWithAppIdAndDelegate("6de68f576fda42ca92a791b38383fee8", myDelegate);
        }

        public int AgoraJoinChannel(string Channel_Name)
        {
            myEngine.SetChannelProfile(AgoraRtcChannelProfile.Communication);
            return myEngine.JoinChannelByKey(null, Channel_Name, "", 0, (Foundation.NSString arg1, nuint arg2, nint arg3) =>
            {
                myDelegate.DidJoinChannel(myEngine, arg1, arg2, arg3);
            });
        }

        public int AgoraLeaveChannel()
        {
            return myEngine.LeaveChannel((AgoraRtcStats obj) =>
            {
                myDelegate.DidLeaveChannelWithStats(myEngine, obj);
            });
        }
    }
}

非常感谢

代码中的某个地方有一个委托,它为该委托基实现接口/类,并调用基类实现

Xamarin SDK有代表基类的概念(因为C#的性质),但在实际的IOS SDK ObjC和协议上并非如此。因此,Xamarin添加了这个异常,以便在执行时标记它,以找到将实现留空或添加自定义代码以处理委托回调的位置


在代码中搜索该异常或在调试器中添加中断异常,一旦调用该异常,它将停止。

中断异常。查看调用堆栈。看看base在哪里被调用。可能是你的一个代表。