A URL created with URL(string:relativeTo:) that used to work in iOS26 and below with UIApplication.shared.open stopped working in iOS27, the app has not been built yet with iOS27 SDK. Have anyone seen this issue, all the links work perfectly in iOS26 and below.
We found a solution to use .absoluteURL but still want to check with the community, I havent seen any mention of this this that it will break try the below sample code
import UIKit
struct RelativeURLReproView: View {
@State private var log = "Tap a button. Watch this log and whether Safari actually appears.\n"
var body: some View {
VStack(alignment: .leading, spacing: 16) {
Button("Open relative URL") {
openTarget(.relative)
}
.buttonStyle(.borderedProminent)
Button("Open absoluteURL") {
openTarget(.absolute)
}
.buttonStyle(.bordered)
Button("Clear log") {
log = ""
}
ScrollView {
Text(log)
.font(.system(.footnote, design: .monospaced))
.textSelection(.enabled)
.frame(maxWidth: .infinity, alignment: .leading)
}
}
.padding()
}
private enum ReproTarget {
case relative
case absolute
}
private func append(_ line: String) {
log.append(line + "\n")
print(line)
}
private func openTarget(_ target: ReproTarget) {
log = ""
let base = URL(string: "https://www.example.com")!
let relative = URL(string: "about/help", relativeTo: base)!
let url = (target == .relative) ? relative : relative.absoluteURL
append("target: \(target == .relative ? "relative" : "absoluteURL")")
append("url: \(url)")
append("absoluteString: \(url.absoluteString)")
append("scheme: \(url.scheme ?? "nil")")
append("baseURL: \(url.baseURL?.absoluteString ?? "nil")")
append("relativeString: \(url.relativeString)")
append("canOpenURL: \(UIApplication.shared.canOpenURL(url))")
append("Calling UIApplication.shared.open…")
append("Did Safari actually appear? Check by eye.")
UIApplication.shared.open(url, options: [:]) { success in
Task { @MainActor in
append("open completion: \(success)")
}
}
}
}
#Preview {
RelativeURLReproView()
}
IMO this is Just A Bug™, and I encourage you to file it as such. Fortunately the workaround is super easy (-:
Please post your bug number, just for the record.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"