【发布时间】:2017-03-08 06:45:05
【问题描述】:
我有一个 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;
}
}
这是特定于平台的实现:
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);
});
}
}
}
非常感谢!
【问题讨论】:
-
打破异常。查看调用堆栈。查看调用 base 的位置。可能在您的一位代表中。
标签: c# android ios xamarin xamarin.ios