Suppose I have a Pro version of the watchOS app, and I want to redirect user to the App Store on the iPhone. How to achieve this?
I tried to use WatchConnectivity
. In the iOS app I have the following code:
func session(_ session: WCSession, didReceiveMessage message: [String : Any]) {
if message[.openProAppOnAppstoreMessageKey] != nil {
// NOTE: Works only in foreground
UIApplication.shared.openURL(.proApp)
}
}
The problem is that this will work only if iOS app is in the foreground. While in the background, session(didReceiveMessage:)
is called successfully, however openURL
has no effect.