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
- Inter-app audio
- Localhost socket - Is this the best approach?: iOS - Is it possible to communicate between apps via localhost?
Apple has carefully avoided exposing this functionality. Has anyone figured out a way to do it anyway?