且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从iPhone向Mac/PC发送消息

更新时间:2022-06-22 22:48:05

这是这里工作的几个主要概念:

This are a couple main concepts at work here:

  1. 连接两个无线设备.为此,您需要 NSNetService 在此处可用.
  2. 在Mac上模拟关键事件.
  1. Connecting two wireless devices. For this you'll need NSNetService and NSNetServiceBrowser, which are the two main classes involved in Bonjour networking. You could use another communication setup, but Bonjour will probably be the least painful. A really useful guide to getting started with this is available here.
  2. Simulating key events on the Mac. CGEventPost() is a really useful function for doing this.