Spotlight results not working when the app is not running

I'm working on Spotlight integration for my mac app, I just indexed the data with CoreSpolight everything working fine when the app is running.

I'm using below mentioned NSApplicationDelegate method to open corresponding content when the user taps the spotlight result.

func application(_ application: NSApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([NSUserActivityRestoring]) -> Void) -> Bool

This method is not triggering when the app is not running (Ensured using NSLog). And I'm expecting it has to open my application as well But both not working as I expected.

What am I missing in this implementation?

Update:

After lots of debugging, I found the root cause of this issue which is the Provisioning profile and signing certificate I'm using. I'm using registered bundleId and provisioning profile with app group enabled. I just enabled Xcode's Automatically manage signing with some random bundleId. All of a sudden above mentioned (mentioned in the question) NSApplicationDelegate method called and app has launched as well. I just compared the Entitlements and Capabilities of two certificates that's looks same. I Still couldn't fix the issue.

Attached screenshots here.

Spotlight results not working when the app is not running
 
 
Q