Search code examples
iosswiftapple-tv

launch new iOS app when opening old iOS app using swift


We already have an OTT iOS app available suppose name is TVFy which is like hotstar.

We are building new app which has much more advanced and we want to launch our new app whenever our users .. open old app i.e. TVFy. This is not update to existing app .. completely new .. new app with new bundle id and new apple account. We wont use our existing old app's bundle id or apple account.

How do we approach this usecase using Swift ? Best way to solve this usecase.

did try to google and various other platforms


Solution

  • Step one: define a URL scheme for the new app. See this article: https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app

    Once this is done, it will allow you to open the new app programmatically from any other app, as long as the new app is already installed on the device. Here is a code sample:

    let url = URL(string: "myphotoapp:")
    
    if UIApplication.shared.canOpenURL(url) {
        UIApplication.shared.open(url, options: [:], completionHandler: nil)
    } else {
        // Use SKStoreProductViewController to let the user download the new app
    }
    

    However, if the new app is not installed yet you probably want to let the user install it. This can be done by presenting the AppStore product page. See this article:

    https://developer.apple.com/documentation/storekit/skstoreproductviewcontroller

    Finally, prepare to be rejected by the AppStore review team. They can reject the old app due to "Lack of Valuable Content". You will probably need to explain your case to the AppStore Review Team and convince them that the old app has enough content.