Context
I'm working on a Swift iOS app in Xcode (iOS 13 and Xcode 11.3).
Goal
Basically, from within my app, I want to be able to open a private podcast feed's URL in the iOS Podcasts app (to add it as a new subscription).
What I'm doing
My understanding is that the way of doing this is by using the open(_:options:completionHandler:) method defined on the UIApplication
class and pre-fixing my URL with podcast://
. Here's an example:
// My URL
let url = URL(string: "podcast://https://username:password@example.com/private-podcast-feed")!
// From inside a `UIViewController` method...
UIApplication.shared.open(url, options: [:]) { (success: Bool) in
// ... handle the result
}
The problem
The code above does open the iOS Podcasts app and trigger an Add a Show by URL...
alert box with its input pre-filled, but the original URL is now prefixed with http://
; i.e. http://https://username:password@example.com/private-podcast-feed
(see attached screen capture at the bottom for an example).
From a "user experience" standpoint, this behaviour is awful, since most people won't notice and the operation will fail.
A potential way around the problem would be to omit the https://
protocol inside my app and use the pre-filled http://
and have a 301 Redirect
on my server (I didn't try it to see if Podcasts follows redirects though), but this is not good for my use-case, since my URL contains credentials.
My question
Does anyone know about a way around this?