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

查看:35
本文介绍了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.

您没有说清楚,但您似乎希望应用在同一台设备上运行.您可以这样做,但这意味着一个应用程序必须在后台运行,为此您需要某种技巧(例如:后台更新位置模式开启)并且不会通过苹果商店.您需要一个很好的理由让您的应用在后台运行(后台播放音乐、为健身应用更新后台位置等)

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天全站免登陆