【问题标题】:Monotouch weird behavior using breakpoint使用断点的 Monotouch 奇怪行为
【发布时间】:2014-03-16 22:25:33
【问题描述】:

我遇到了一个我试图理解的非常奇怪的行为。 在使用 Xamarin 和两个 3rd 方库(一个是信用卡阅读器 - UniMag 和条形码扫描仪)开发 iOS 应用程序时。

我正在添加观察者:

var center = NSNotificationCenter.DefaultCenter;
        center.AddObserver ("uniMagAttachmentNotification", Attached);
        center.AddObserver ("uniMagDidConnectNotification", Connected);
        center.AddObserver ("uniMagSwipeNotification", SwipeReady);
        center.AddObserver ("uniMagDidReceiveDataNotification", DataProcess);
        center.AddObserver ("uniMagSystemMessageNotification", UnimagSystemMessage);
        center.AddObserver ("uniMagDataProcessingNotification", DataProcessNot);
        center.AddObserver ("uniMagInvalidSwipeNotification", InvalidSwipe);
        center.AddObserver ("uniMagSwipeNotification", SwipeNotification);

如果我有一个断点

void SwipeNotification (NSNotification notification)
    {
        string justForTheBreakPoint = "f";
    }

然后一切正常,如果我删除它,那就不行了。该应用程序不会崩溃,只是没有按预期工作。我知道它含糊不清。

我的问题是,断点实际上会影响应用程序的行为吗?

【问题讨论】:

    标签: xamarin.ios xamarin


    【解决方案1】:

    通常当设置断点修复问题时,意味着您遇到了线程问题。通过设置断点,您可以中断正在运行的线程并允许其他并行线程运行。

    【讨论】:

    • 你是对的,通过添加 Thread.Sleep 代替,它确实有效。谢谢!
    猜你喜欢
    • 1970-01-01
    • 2012-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-08
    相关资源
    最近更新 更多