0

我刚开始在 WP8 上玩蓝牙通信。我在这里找到了一个例子:http: //msdn.microsoft.com/en-us/library/windowsphone/develop/jj207007 (v=vs.105).aspx

但是,一旦 Peerfinder.Start() 被击中,我就会收到此错误:PhoneApp3.DLL 中发生“System.UnauthorizedAccessException”类型的第一次机会异常

public MainPage()
{
    InitializeComponent();
    PeerFinder.Start();
}

async private void AppToApp_Click(object sender, RoutedEventArgs e)
{
    // PeerFinder.Start() is used to advertise our presence so that peers can find us. 
    // It must always be called before FindAllPeersAsync.
    var peers = await PeerFinder.FindAllPeersAsync();

    if (peers.Count == 0)
    {
        Debug.WriteLine("Peer not found.");
    }
    else
    {
        Debug.WriteLine(peers.Count + " peers found");
    }
}
4

1 回答 1

4

确保您已将功能 ID_CAP_PROXIMITY 和 ID_CAP_NETWORKING 添加到应用程序清单中。

于 2013-09-15T20:24:08.803 回答