Open parent app from ShieldAction extension in iOS

When I tap on one of the buttons in the ShieldAction extension I want to close the shield and open the parent app instead of the shielded app. Is there any way of doing this using the Screen Time API?

class ShieldActionExtension: ShieldActionDelegate {
  
  override func handle(action: ShieldAction, for application: ApplicationToken, completionHandler: @escaping (ShieldActionResponse) -> Void) {
    // Handle the action as needed.
     
    let store = ManagedSettingsStore()
         
    switch action {
    case .primaryButtonPressed:
      //TODO - open parent app

      completionHandler(.defer)
    case .secondaryButtonPressed:
      //remove shield
      store.shield.applications?.remove(application)
      completionHandler(.defer)
   

    @unknown default:
      fatalError()
    }
  }  
}

Launching your parent app from your Shield Action extension is not currently supported. Please use Feedback Assistant to request an enhancement to the API.

Hello, Unfortunately, with the new iOS 17 and XCode 15 Beta this new feature is not supported.

Disappointed that this hasn't been added with iOS 17. Seems like a pretty simple and meaningful addition.

Can we not just support opening a deep linked URL to our app from the shield extension?

There should be a workaround, however I couldn't figure it out yet. The one-sec App for example is using exactly what is described here. It seems like the app launches itself through the shielding with a custom deeplink. I have tried opening my own app through the openURL property in the Environment and with NSExtensionContext. Here's what I've tried:

Opening through Environment

@Environment(\.openURL) var openURL
override func handle(action: ShieldAction, for application: ApplicationToken, completionHandler: @escaping (ShieldActionResponse) -> Void) {
    // Handle the action as needed.
    switch action {
    case .primaryButtonPressed:
      openURL.callAsFunction(YourAppDeeplink)
// other code
}

Opening with NSExtensionContext

private func openApp(with url: URL) {
    let context = NSExtensionContext()

    context.open(url, completionHandler: nil)
}

However, neither approach has been successful in launching the app as intended. The one-sec App using this feature implies, that there must be a workaround or alternative method that we're missing.

@Maximillian-Dev Were you able to find a workaround for this? I am running into the same issue.

https://apps.apple.com/us/app/app-lock/id6448239603 &

https://apps.apple.com/us/app/applocker-passcode-lock-apps/id1132845904

These apps are somehow doing, opening the parent app Shield Action.

Is there any way to do so? also when I lock app and click on app, Shield Config UI is not coming, default UI is coming.

@Frameworks Engineer this means that those apps are breaking sandboxing? Is there any way to open the app without using private apis?

Open parent app from ShieldAction extension in iOS
 
 
Q