iOS应用程序可以通过套接字进行通信吗? [英] Can iOS apps communicate via sockets?

查看:114
本文介绍了iOS应用程序可以通过套接字进行通信吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将为iOS开发一些应用程序.它们可以通过套接字相互通信吗?假设一个应用程序作为服务器运行(即使在后台模式下),而另一个则作为客户端连接到服务器应用程序并执行一些通信.是否违反任何App Store规则?如果我的想法由于某些原因无法正常工作,iOS中是否有可用的IPC?

I'm going to develop few apps for iOS. Can they communicate to each other via sockets? Let's say one app runs as server (even in background mode) and another as client connects to server app and perform some communication. Does it violate any App Store rules? Any available IPC in iOS if my idea is not working for some reason?

推荐答案

您当然可以,并且没有违反任何规则.

Of course you can and it doesn't violate any rules.

只是CoreFoundation库.

Just just the CoreFoundation libraries.

如果它已经全部写在Apple的官方文档中,那么我对您没有任何描述:

There's no point in me describing it to you if it already has been all written in the official Apple documentation:

https://developer.apple .com/library/ios/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/UsingSocketsandSocketStreams.html

您可以在此处找到示例,可以执行和无法执行的所有方法和事情.

You can find here examples, all approaches and things you can and cannot do.

您不清楚,但似乎您希望这些应用程序在同一设备上运行.您可以执行此操作,但这意味着一个应用程序必须在后台运行,并且要做到这一点,您需要某种黑客手段(例如:后台更新位置模式为ON),并且这种情况不会超过Apple Store的要求.您需要一个很好的理由让您的应用程序在后台运行(后台运行音乐,为健身应用程序在后台更新位置等).

You didn't make that clear but it seems like you wanted the apps to run on the same device. You can do that but that would mean that one app has to run in background, and to do that you need some kind of hack (for example: background updating location mode ON) and that won't get past apple store. You need a very good reason to have your app ran in background (music in background, update location in background for fitness apps etc.)

此外,这是一个重复的问题:

Besides, it's a duplicate question:

iOS-应用之间是否可以通信通过本地主机?

这篇关于iOS应用程序可以通过套接字进行通信吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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