尝试调试此Xamarin解决方案时, build 成功,但在尝试在模拟器上打开应用程序时,此消息将在应用程序输出中抛出:
无法注册选择器'窗口'会员' Mobile.iOS.AppDelegateIPad.get_Window'因为选择器已在会员' get_window'上注册。 (MonoTouch.RuntimeException)
然后,callstack显示我们已停在某处,但点击任何一行并不会将我带到实际代码:
点击播放"继续执行"在调试菜单中的按钮,模拟器将我带到设备的主屏幕(远离应用程序),然后在应用程序输出中显示以下消息:
执行本机代码时获得了SIGABRT。这通常表明 单声道运行时或其中一个本机库中的致命错误 由您的应用程序使用。
我不确定这是否是Xamarin项目的常见做法,但实际上我们有两个AppDelegate
个文件:
这两个类都继承了抽象类UIApplicationDelegate
,并且这两个类都覆盖了抽象类' UIWindow
财产。
引用AppDelegateIPad
和AppDelegateIPhone
类的唯一地方是两个 .xib 文件:
问题是,我们的应用在生产中正在运作,目前在应用商店中。我刚刚开始这个项目,并且是Xamarin的新手。最初的开发人员不久前离开了团队。由于此解决方案一次正在运行,我认为我遇到的错误与我使用新版本的Xcode比原始开发人员使用的错误有关。但是,所有使用不同版本的Xcode或iOS SDK的尝试都没有解决问题。
非常感谢任何帮助。我很乐意提供您可能需要的任何其他信息。谢谢!
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace Mobile.iOS
{
// The name AppDelegateIPad is referenced in the MainWindowIPad.xib file.
public partial class AppDelegateIPad : SDSApplicationDelegate
{
//Deleting this property will allow the debugger to run an iPhone
public override UIWindow Window {
get {
return window;
}
set {
window = value;
}
}
// This method is invoked when the application has loaded its UI and its ready to run
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{...
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace Mobile.iOS
{
// The name AppDelegateIPhone is referenced in the MainWindowIPhone.xib file.
public partial class AppDelegateIPhone : SDSApplicationDelegate
{
private SDSInitialLoadViewController _InitialLoadViewController;
private SDSLoginTableViewController _LoginTableViewController;
public SDSMainMenuTableViewController MainMenuTableViewController {
get;
private set;
}
public override UIWindow Window {
get {
return window;
}
set {
window = value;
}
}
// This method is invoked when the application has loaded its UI and its ready to run
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{...