我刚开始在 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");
}
}