4

In my Swift iOS app, I have code that uses the user's location. When the user declines to allow user location access, we have a warning message that gives the user the option to go to the settings page to change their decision. If they choose that option, we open the app's settings like so:

if let url = URL(string: UIApplication.openSettingsURLString) {
  UIApplication.shared.open(url)
}

That all works fine. It's also worth noting that the openSettingsURLString resolves to "app-settings:"

I'm reusing the same code in an App Clip for my app. In my App Clip, the openSettingsURLString also resolves to "app-settings:", and I'd like to believe that iOS would resolve that to the app settings page for my App Clip. Instead, it looks like iOS wants to resolve "app-settings:" to the settings page for my main app (and in the more likely case that the main app isn't installed on the device, it just takes me to an early page in the Settings app).

Is there a way to open the App Clip's settings page?

aheze
  • 24,434
  • 8
  • 68
  • 125
bcholmes
  • 944
  • 1
  • 9
  • 23
  • I was just about to ask the same question. Did you find a solution? – aheze Mar 19 '21 at 02:48
  • Sadly, no. I suspect that it's a bug/oversight in Apple's implementation of App Clips. – bcholmes Mar 19 '21 at 13:28
  • Haven't tried it, but I'd wrap that in `UIApplication.shared.canOpenUrl(url)`. If Apple did the right thing, you can use the return value to do different things in your full app/App Clip – pietrorea Aug 19 '21 at 03:40

1 Answers1

1

I've managed to get this working on iOS 16 by using the following URL:

App-Prefs:APP_CLIPS&path={YOUR_APP_CLIP_BUNDLE_ID}

e.g.

App-Prefs:APP_CLIPS&path=com.yourapp.Clip

Disclaimer: I haven't had a chance to test on earlier versions of iOS.

Chris
  • 217
  • 1
  • 2
  • 10