如何从iPhone向Mac/PC发送消息 [英] How to send a message from iPhone to Mac/PC

查看:351
本文介绍了如何从iPhone向Mac/PC发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个新的应用程序-我猜这个概念真的很简单.

I'm looking to start a new application up - the concept's really simple I guess.

您按下iPhone上标有"1"的按钮,它将向PC或Mac发送一条消息,使mac/PC做出的响应就像在计算机自​​己的键盘上按下数字"1"一样.

You press a button labelled '1' on the iPhone and it sends a message to the PC or Mac that makes the mac/PC respond exactly as if the number '1' had been pressed on the computer's own keyboard.

现在,我认为我将不得不对此做一些认真的阅读,而我很乐意对此加以说明,因此我不想寻找哦,这就是答案"的答案,但是有人可以吗?为我提供了一些帮助,以使我朝正确的方向前进.我知道诸如Rowmote之类的应用程序实际上已经做到了这一点,并且它们具有自己的基于桌面的客户端-我从哪里开始研究如何做到这一点?出版的书籍,在线指南等都是开始研究该问题的好方法,但是有人知道哪个吗?任何帮助表示赞赏.

Now I think I'm going to have to do some serious reading around on this one and I'm happy to put that in so I'm not looking for a "Oh this is the answer" response, but can someone offer me some help to get me going in the right direction, I'm aware of applications such as Rowmote that essentially do this already and that they have their own desktop based client's - where do I start looking into how to do this? Published books, online guides etc are all great ways to start looking into this but does anyone know which ones? Any help much appreciated.

推荐答案

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

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.

这篇关于如何从iPhone向Mac/PC发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆