skip to Main Content

My app has been in the app store for a while now. I now want to add an app clip which has a button that sends the users to download the full app from the app store (Using SKOverlay). In addition, I want the app clip to pass parameters to the full app (this step is crucial).
for example, the user’s name will be passed to the full app and presented in the main activity. This is done by putting this info in the shared user defaults in the app clip, and extracting this info from the shared user defaults in the full app.

I created the app clip with these features and now want to test the transition from the app clip to the full app.

I tried 3 different approaches, but none of them enabled me to simulate the full app-clip-to-full-app experience:

  1. Running the app clip in Xcode and testing with _XCAppClipURL environment variable. The SKOverlay popped up but it doesn’t actually enable me to open the app store.
  2. Setting up a local experience on my test device (as explained here) also showed the SKOverlay but didn’t enable me to actually open the app store.
  3. Test Flight: I uploaded the build to the app store in order to use Test Flight and added an app clip invocation URL to the internal and external testing. When opening the app clip using Test Flight, the ‘Get the full app’ button actually sent me to the app store, but to the old version of the app. Needless to say, the old version of the app is irrelevant to the test as it doesn’t have the code necessary to extract the user’s name from the shared user defaults.

Is there a way for me to test this transition without releasing the newest version to the app store?

EDIT: I’m using the UserDefaults with an app group. I defined an app group with the same name in the ‘signing and capabilities’ section of both the full app and the app clip. And added the following code:

In the app clip’s scene delegate:


let username = "Oded"
guard let sharedUserDefaults = UserDefaults(suiteName: "group.fruitapp.appClipToFullApp") else {
            return true
        }
        

        if sharedUserDefaults.string(forKey: "username") == nil {
            sharedUserDefaults.set(username, forKey: "username")
        }
        
        return true

In the full app’s app delegate:

guard let sharedUserDefaults = UserDefaults(suiteName: "group.fruitapp.appClipToFullApp"),
          let username = sharedUserDefaults.url(forKey: "username")
                else {
                    print("Could not find the App Group or the usename from the app clip")
                    return
                }
            print("username is (username)")

            //Do more stuff

2

Answers


  1. The SKOverlay is nothing more than a gratified App Store link.

    It’s not possible to simulate that exact flow (because on Debug the SKOverlay does nothing), but I also don’t think it’s necessary.

    What you can do to test your flow is to install your App Clip through Xcode, go through the experience, and then install the full app through Xcode.

    Update:

    If you want your Clip and your App to share data through User Defaults, you will have to use App Groups.

    Login or Signup to reply.
  2. I also struggled with testing this transition and thought it was not possible at one point. It’s not only possible, but actually pretty important to test so that the upgrade experience is smooth.

    Some points:

    • You don’t need the App Store for anything. That’s a separate system. Build the App Clip locally to your device (with _XCAppClipURL), and then simulate the upgrade by building your full app to the same device.
    • As mentioned already, you need to be set up with App Groups and use the UserDefaults API properly. NOTE: The setup part is tricky, if you don’t see the data you expect after you build your full app, then it’s not set up correctly.

    Some things to check:

    1. The provisioning profiles for BOTH the app clip and the full app need to have the App Group entitlement. You might have PPs for Debug and Release configurations, so keep that in mind.
    2. The Capabilities tab for BOTH the app clip and the full app need to have the App Groups enabled.

    Those two things might be obvious but I got them wrong.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search