I have a couple of custom apps (masterapp and app2), both belonging to the same custom URL scheme. When I click a button on the masterapp, I want it to open app2.
I've noticed a weird pattern where by the master app only opens app2 if app2 was installed before the master app.
If I install the masterapp, then install app2 then click the button to open app2 it just doesn't do anything.
Can anyone explain this behaviour and what is going on? I've played around with URL schemes for days now but can't get this to work properly.
You can't do this.
The URI scheme need to be unique to each app. There have actually been a few instances where third-party apps attempt to hijack the private URI schemes of popular apps, and this is part of the reason Apple introduced Universal Links in iOS 9.
If you think it through logically, the behavior you are experiencing makes perfect sense: if two apps with the same URI scheme are installed, then the app you installed first is the one that will respond when that URI scheme is triggered.