Is there a way to detect if user was already in yo

2019-07-25 21:35发布

问题:

Is this possible to know inside my Siri intent handler if the user was in my app before launching Siri?

回答1:

You can use App Groups to share data between your app's main target and your Siri intent handler. You could simply store a Bool in UserDefaults indicating whether your app was already launched or not, then access the same value using App Groups from your Siri intent handler.

For more information on App Groups, see the App Extension Programming Guide.