Is cross-process communication between iOS apps possible using sockets?

I have looked through many articles on the internet and most of them say that IOS applications allow IPC to use protocol handlers (URL schemes). But can't we achieve IPC using sockets if one application opens a port and another tries to connect to it?

+3


source to share


2 answers


No, this is not for several reasons. 1) Apple does not allow this internally and has security levels to prevent it. 2) Apps launch the DiD / WillEnterBackground app after a short delay and then how you can interact with it happens.



If you really want to send data between apps, configure the server with certificates to match your app so you can use APNs (Apple push notifications) to send data to silent clicks on apps. Then, set up the endpoints on the server that trigger these submissions, and the applications use the API that the server provides.

+1


source


iOS8 offered IPC support by providing mach ports for so-called "application groups". Check out this great tutorial:

http://ddeville.me/2015/02/interprocess-communication-on-ios-with-mach-messages/

It requires a bit of tweaking (to define app groups in the dev portal, create the correct permissions, etc.), but it's really not that hard and Xcode 6 does most of the job automatically (just enable "app groups" in overall power).

I can confirm it works (I was able to create 2 apps sending messages to each other).

There is no official IPS support in iO7 , but if you don't plan on uploading your app to the AppStore, you can try to use cross-app audio communication to achieve this. Check out Apple's sample code that demonstrated data flow between apps between 3 apps:



https://developer.apple.com/library/ios/samplecode/InterAppAudioSuite/Introduction/Intro.html

Related WWDS video:

https://developer.apple.com/wwdc/videos/#602

I am not trying to use it for silent use, but I see no reason why it shouldn't work. The baud rate is great and the audio data is just bytes and doesn't need to be redirected to the speaker, but interpreted as you like.

Of course, it will be rejected in the AppStore review, but it is still suitable for corporate or personal use.

0


source







All Articles