Inconsistent ios app launch with same URL for app clips using NSUserAcitivty in AppDelegate

Before App Clips, our app (if installed) could be launched by scanning a QR code. In such a case, AppDelegate would call NSUserActivity with the payload and we would extract QR code data for parsing and actioning.

After App Clip launched, the same behavior continued until recently (assuming before 14.4). Now, if the user has the app installed and they scan the QR code, they get the App Clip card to open the app. If the user taps on 'Open', the full app is launched. However, now the initial view controller launches before AppDelegate is able to receive and parse NSUserActivity data. This creates, I assume, some kind of a race condition where majority of the times initial root controller has malformed or no data.

My understanding is that NSUserActivity is the best way to handle application launches so I am not sure how to properly address this problem versus writing some hacky workarounds.

In our testing, we have noticed interesting situations where iOS would sometimes launch the full app without showing the app clip card (less frequently) and the full app would work fine. But majority of the times, it will show the app clip card and it would break our full app if it is installed.

Our full app and app clip use the same domains (universal applinks) and we do the decision making based on URL params within the app. Basically, our applink is configured to be example.com and within both apps (i.e. full and app clip), we extract business_name=FOO and item_id=BAR within AppDelegate (where full URL might be: hxxps://example.com/Order?buiness_name=FOO&item_id=BAR.

I am hoping someone can offer advice on how to solve/fix this problem.
Inconsistent ios app launch with same URL for app clips using NSUserAcitivty in AppDelegate
 
 
Q