1

I need to implement next scheme:

1) App1 has some UI like signin/signup, and user's profile. But main functionality is creating specific http request to get/update token.

2)when tapping button at App2 - App2 calls App1, then App1 execute only http request, and return token to App2, like callback. And this actions should be invisible for user, maybe like empty screen with spinner

What is the best way to make it real? Is it possible for iOS?

To share data between apps I suppose use App Group and shared UserDefaults, but how to call some class/function?

nastassia
  • 807
  • 1
  • 12
  • 31

2 Answers2

2

iOS is extremely strict as far as inter-app communication. While this is for the safety of their users, it can be extremely annoying for developers.

I'd recommend using x-callback-url for this, if you own both of the apps you're trying to communicate with.

Unfortunately for your uses, this will throw your user into the other app, which will be visible to the user for a short amount of time.

That's the only way to directly interface with other apps on the system.

Jackson Zamorano
  • 343
  • 1
  • 3
  • 8
1

some addition to @hobbsome answer

here is some useful info

and here is sample project with two apps, that communicate in-two-direction using x-callback-url protocol

you can parse your link at AppDelegate class, then redirect to ViewController and update its UI - check this answer

nastassia
  • 807
  • 1
  • 12
  • 31
  • and one more addition for iOS 13 - check this question to make your AppDelegate works correctly - https://stackoverflow.com/questions/58624786/method-applicationopenurloptions-is-not-called – nastassia Feb 21 '20 at 23:36