适用于 iPhone 的 MQTT 客户端
我正在尝试按照这个 博客 为 iPhone 构建推送服务。该博客使用 Android 作为工作平台,但它也可以迁移到 iPhone,前提是我在 Objective C 中获得了 MQTT 客户端。但我在任何地方都找不到。我最接近的是:
谁能帮我利用这两个选项吗?我不知道下一步要采取:(
谢谢!!
I am trying to follow this blog for building push services for iPhone. The blog uses Android as the working platform,but it can be migrated to iPhone too, provided I get an MQTT client in objective C..which I cant find anywhere. The closest I got to this is :
Can anyone please help me exploit these two options ? I dont know the next step to take :(
Thanks !!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我对 Objective C 一点也不熟悉,但似乎你可以将任何 C 代码编译为 Objective C。这会解决你的问题吗?
如果您使用 gcc,则可以使用“-x Objective-c”强制将其编译为 Objective C。
I'm not familiar with Objective C at all, but it seems as though you can compile any C code as Objective C. Would this get round your problem?
If you're using gcc, you can force it to compile as Objective C using "-x objective-c".
在这种情况下,HTTP 选项对您没有帮助,因为您没有尝试通过 MQ 与 JMS 应用程序通信(好吧 - 您没有说过这是您的目标)。最好的选择是编译 libmosquitto 或其他 MQTT 客户端之一(请参阅 http://mqtt.org) 适用于 iPhone。现在有一个很好的例子 https://github.com/njh/marquette 它在 iOS 上使用 mosquitto 的库
The HTTP option would not help you in this case as you're not trying to talk to a JMS app via MQ (well - you haven't said that is your goal). Your best bet would be to compile something like libmosquitto or one of the other MQTT clients (see list at http://mqtt.org) for the iPhone. There's now a good example https://github.com/njh/marquette which uses mosquitto's libraries on iOS
我目前在我的项目中使用 MQTTKit 。使用起来相当简单和直接。
I am currently using MQTTKit in my projects. It's fairly easy and straightforward to use.
对于 swift,您可以使用以下库: https://github.com/ltg-uic/ ios-mqtt-base
For swift you can use the following library : https://github.com/ltg-uic/ios-mqtt-base