2

We are developing an SDK for iOS which requires different apps on the same device to know each other and pass information between them.. This is required for battery consumption and network usage purposes.

Using custom UIPasteboard is not an option because the SDK will be hosted by apps from different companies.

Using openURL is not an option because it forces the target app to become foreground.

Our current idea consists of sending UDP packets between the different apps (each app listening on a different port).

Our questions:

1) Is there a simpler option?

2) Do you think that such a solution is somehow not allowed by Apple’s terms & conditions?

TalL
  • 1,661
  • 16
  • 16
  • 1
    It's not really a question of terms & conditions, it's the capability of the environment; Only the foreground app can listen for network connections, so you won't be able to use UDP for interprocess communication. The apps will probably need to communicate via a network server. – Paulw11 Oct 06 '19 at 11:11
  • My hosted apps work in the background, so I can listen while in the background. This is tested. My concern regarding apple rejecting the hosting app stems from the fact that apple goes to extreme measures to sandbox each application, and to remove any unique id which identifies the device, and this solution actually circumvents all their efforts.. It's like having a unique device id. Even though our intentions are pure (and not related to showing ads), I fear that apple may reject it. – TalL Oct 06 '19 at 18:09

1 Answers1

0

Because of limitations of iOS most reliable solution in this case would be using backend.

But if you still want to try - there is one option. You can use tools like GCDWebServer (https://github.com/swisspol/GCDWebServer and you can find more options) to set up local server on the device. Then you can use it to share resources. The problem here - is that you will not be able to run it in background all the time. You can investigate how you can make your app to run in background (using location updates or silent notifications) to check if this can satisfy your needs. Maybe your solution can be: combining backend server + local server + background app refresh

lobstah
  • 871
  • 7
  • 12
  • I don't see the advantage of GCDWebServer over UDP. Especially that my app already has UDP functionality baked in. I agree that a backend is required in order to do the initial matching (by noticing that two apps are communicating from the same ip address), notify both apps to test, which port to listen on, which port to send data. I just wish I could do a COMPLETE backend solution, without UDP... But that will require a unique device identifier and apple doesn't allow it.. – TalL Oct 06 '19 at 18:05