3

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?

2 Answers 2

2

As long as your apps are in the same app group, then yes, socket IPC is allowed. If not, then no. Sockets map to file descriptors (Berkeley sockets), and these files are sandboxed to the app or app group. More info: http://ddeville.me/2015/02/interprocess-communication-on-ios-with-berkeley-sockets

Sign up to request clarification or add additional context in comments.

Comments

1

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

Just just the CoreFoundation libraries.

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.

EDIT:

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 - Is it possible to communicate between apps via localhost?

4 Comments

just to be more detailed (though i expect the answer): "iOS app running on the same device?"
I dont understand. You want the apps to be on the same device ?
yes at the same device, one as a server and one as a client
there are some caveats with listening on sockets in iOS, the trick is to close them just in time, see forums.developer.apple.com/thread/85038#253216

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.