Question

There are a number of similar questions so this one is carefully scoped not to be a duplicate.

Preconditions

  • There are two iPhone apps (separate bundle IDs), and you have full control over the source code of each one
  • The user has both apps installed on the same phone
  • No network connectivity to other hosts
  • No jailbreaking
  • Assume the apps have proper capabilities to run in the background indefinitely

Goals

  • Communicate bidirectionally between the apps
  • Minimize or eliminate user-observed evidence that such communication is taking place
  • Background app will have new information that needs to go to the foreground app, so need push or polling mechanism
  • Ideally could be used in production and so doesn't use private APIs

So the question is "Can it be done?"

What follows are some notes on "Already tried" - different approaches that have been considered.

Well understood attack vectors

  • Use another host - reasonable, but excluded in the problem definition because of latency
  • Custom URL schemes - a pretty good approach, but not ideal because of animations and context switches, especially if polling
  • Stuff under Settings.app -> Privacy (e.g. Contacts) - would work, but would rather not ask for permissions

Things that probably won't work

  • "Open in..." api
  • Shared filesystem in some way
  • Bluetooth

Possible ideas

Apple has carefully avoided exposing this functionality. Has anyone figured out a way to do it anyway?

Was it helpful?

Solution

One more idea: start local web server in one apps on iPhone and use it for communications between apps.

Here is implementation of such server

And here is usage example

I haven't tried this solution by myself but saw apps that use this idea for communications.

Also, I believe that Apple intentionally not implement any easy way to communicate between apps. Now you can make you app like it is the only one application on the whole device with little exceptions like memory usage and etc. As soon as here will be some easy way to communicate between apps we will found ourself in much more complicated environment. We will need to consider much more limitations, rules and possibilities as programmers.

But I also would like to have some way to communicate between apps, many great ideas can be implemented with this tool.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top