onContinueUserActivity(NSUserActivityTypeBrowsingWeb) getting called twice

Last week I finally finished setting up my first App Clip by following the documentation made by Apple.

However, there is a pesky bug I can't seem to iron out and it's somehow related to the .onContinueUserActivity(NSUserActivityTypeBrowsingWeb) getting called more than once when testing the app clip.

It runs great on the first try, but afterwards it behaves as if there was already a url stored in cache or something of the sort. I change this URL by changing the _XCAppClipURL environment variable on the App Clip Scheme.


Code Block
.onContinueUserActivity(NSUserActivityTypeBrowsingWeb) { userActivity in
guard let incomingURL = userActivity.webpageURL,
let components = NSURLComponents(url: incomingURL, resolvingAgainstBaseURL: true) else {
return
}
print(incomingURL)
}


This works great on the first run; it gets called only once.

After the first run, it will call one of the older URLs I passed and the new one. It will also call them on different orders, sometimes the older one first, sometimes the new one first.

I'd appreciate any advice or theories you can come up with, all help is appreciated!

Thanks!

Did you manage to fix this problem? This is happening for me too and other than adding business logic checks to prevent this from executing the closure, I don't know what to do...

I have a similar issue but it is triggered by taking a screenshot. After launching the App Clip with an invocation URL, taking a screenshot triggers my selector for onContinueUserActivity(NSUserActivityTypeBrowsingWeb) to be called. I'm not even sure where this URL is coming from as it's not an invocation that I have launched recently.

 Did you find any solution?

I also have a similar problem. In my case, the onContinueUserActivity(NSUserActivityTypeBrowsingWeb) is called at the AppClip launch time, which I expect, but it is also called every time the AppClip receives a push notification. I've just discovered this surprise, just one day before I have to release the app in the App Store. Looks like someone's not sleeping tonight...

onContinueUserActivity(NSUserActivityTypeBrowsingWeb) getting called twice
 
 
Q