2

Scenario:

  • I have developed two apps, App A and App B, both which the user has installed
  • App A is running
  • App A needs to obtain a string stored in App B
  • After obtaining the string, App A will still be running
  • No "switching animations" should be visible to the user. That is the user should not be receiving any feedback (e.g. switching to App B and then back to App A) that this communication is happening.

On Android, this is trivial, but I can't figure out how to do this on IOS 7.

UsAaR33
  • 3,536
  • 2
  • 34
  • 55
  • What did you try? Why are the apps separate? Is a calculation required or the data is already known to app B? – Wain Mar 05 '14 at 23:18
  • This can only be done if App B already made the data available. App A can't make a request to B if B is in the background (at least not without switching the user to B). – rmaddy Mar 06 '14 at 00:20
  • 1
    I phrased the constraints and situation better on a new question: http://stackoverflow.com/questions/22215092/how-can-one-app-provide-data-to-another-without-swiching-apps – UsAaR33 Mar 06 '14 at 04:38

2 Answers2

4

You have several possibilities:

  • Make App B send the string to a server and retrieve it on App A
  • Make App B store the string on keychain and make App A read it (using the same Keychain Access Group, as explained here)
  • Create a private UIPasteboard to share the information (as explained here).

PS: App A and B must be from the same vendor, or none of these possibilities will work on iOS 7.

EDIT: as @rmaddy pointed out, these will only work if App B provides the data before App A asks for it.

Community
  • 1
  • 1
Marcelo
  • 9,916
  • 3
  • 43
  • 52
  • 1
    Of course none of this works unless App B already provided the data before App A asked for it. – rmaddy Mar 06 '14 at 00:21
  • Oh app A and app B are from different vendors. This info is helpful though; I'm going to make a new question. – UsAaR33 Mar 06 '14 at 03:34
0

Something like http://Parse.com or http://openkeyval.org/ will let you store simple data to 'the cloud' quickly & easily. Store it from one app according to a system that will let you deduce the key on the other app. Then retrieve it from the second app via networking.

Obviously you need a network connection for this, but given you're just talking about strings it should be fine even on a dodgy E or 3G connection.

(I am in no way affiliated with parse or openkeyval. I have used Parse as a dev and I think they're good.)

buildsucceeded
  • 4,203
  • 4
  • 34
  • 72
  • If I don't want App A to request credentials from the user, how do I do this securely? (where 3rd parties can't access the data app B stores in the cloud) – UsAaR33 Mar 06 '14 at 03:35
  • If you want true security it's harder, but if you want a normal level of privacy, just pick your keys in a way where they can't be easily guessed. As another option you could have the two apps share a key via app-switching ONCE only, after which they could both use that key as part of the cloud URL – buildsucceeded Mar 06 '14 at 10:11
  • I don't want to do any app switching. How could I pick the keys securely as both A and B would need to know them? – UsAaR33 Mar 06 '14 at 22:17
  • Then you'd have to base them on some piece or pieces of information that both apps can know about. UDID is gone/deprecated, so you'd have to (programmatically) get and hash, say, the user's phone number or name, perhaps combined with some other similarly-unique-but-persistent information. – buildsucceeded Mar 06 '14 at 22:45