iOS App和Mac App之间的强大实时通信 [英] Robust real-time communication between iOS App and Mac App

查看:315
本文介绍了iOS App和Mac App之间的强大实时通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在制作一个展览( http://pulse.media.mit.edu )而且我是iOS,objective-c和Xcode的新手。展览截止日期是一周,我被卡住了。

We're working on an exhibit (http://pulse.media.mit.edu) and I'm brand new to iOS, objective-c and Xcode. The exhibit deadline is in one week and I'm stuck.

我遇到的问题看起来很简单。

The problem I'm having seemed simple enough.

我们的展览有投影仪和iPad。投影机将连接到Mac并播放视频。 iPad将充当这些视频的控制器。更简单:

Our exhibit has a projector and an iPad. The projector will be hooked up to a mac and be playing a video. The iPad will act as a controller for those videos. More simply:

我在Mac上有50个视频。我需要在Mac上开发一个应用程序,当打开它时会循环其中一个视频。

I have 50 videos on a Mac. I need to develop an application on the Mac, that, when opened will loop one of the videos.

在iPad上,我需要开发一个可以在两者之间切换的应用程序麦克风上的视频实时。 iOS应用程序已经设计好了,我们只是在努力解决一些代码问题。

On an iPad, I need to develop an app that can change between the videos on the mac in real time. The iOS app is already designed, we're just struggling with some code.

在Mac上,当iPad告诉Mac更改视频时,我们希望它使用Core Animation在视频之间切换,如下所示(http:// youtu) .be / pyd8O-2mkgk?t = 1m)。

On the mac, when the iPad tells the Mac to change video, we'd like it to switch between videos using Core Animation, like this (http://youtu.be/pyd8O-2mkgk?t=1m).

所以我的问题:最有效的方法是什么?它必须能够在博物馆中运行两个月。有些事情需要考虑:

So my question: What is the most robust way to do this? It has to be able to run in a museum, for two months. Some things to consider:


  • 我们距离4000英里,无法一直监控。我们每晚都会查看
    ,看看它是否仍在使用,但它应该在
    运行一天而不会中断。

  • 如果有人拔下iPad,它仍然可以正常工作。

  • 它应该尽可能强大。

我怎样才能做到最好?我应该从iPad写入数据库到连接的Mac上本地运行的数据库,然后每秒监控该数据库10次吗?套接字是否足够强大,可以单独使用?

如果你确实建议了一种方法,请指点我指向一些资源(框架,函数名称) ,等),可以帮助我快速做到这一点?

If you do suggest a way, can you please point me in the direction of some resources (frameworks, function names, etc) that can help me do this quickly?

感谢您的时间。

推荐答案

我会去中间服务器选项,因为它最容易调试,并且只需要客户端上的工作互联网(wifi)连接。遇到连接问题时,您只需要知道如何将iPad或Mac连接到互联网。你可以看到服务器端哪个设备连接有问题。

I would go for the server-in-the-middle option, because it will be easiest to debug, and requires nothing more than a working internet (wifi) connection on the client side. When having connection issues, all you need is someone who knows how to hook up an iPad or Mac to the internet. And you can see server-side which device has issues connecting.

此外,使用普通的HTTP听起来是最好的通信方式,后端可以写成任何服务器端脚本语言。两个客户端应该每X秒轮询一次服务器。

Furthermore, using plain HTTP sounds like the best way to go for communication, and the backend can be written in any server side scripting language. Both clients should be polling the server every X seconds.

如果你在截止日期之前完成了这个基本设置,你可以尝试让设备直接连接到彼此(为了减少用户体验),并将服务器解决方案留在那里作为后备方法。 Mac应用程序可以充当HTTP服务器,接受与iPad通常发送到服务器的命令完全相同的命令。挑战在于可靠地了解要连接的IP。您可以对其进行硬编码或使用Bonjour。

If you get this basic setup working well before your deadline, you could try to get the devices to connect to eachother directly (for a less sluggish user experience), and leave the server solution in there as a fallback method. The Mac app could function as a HTTP server, accepting the very same commands that the iPad normally sends to your server. The challenge will be to reliably know which IP to connect to. You could hardcode it or use Bonjour.

这篇关于iOS App和Mac App之间的强大实时通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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