From e55a23050e0bdf87e0aa0d5b41470d5f184e3725 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 26 Dec 2024 14:03:27 -0500
Subject: [PATCH] misc: Make SDL_OpenURL work with VisionOS, tvOS, etc.
(cherry picked from commit 7bbe6025be20c892fbba5678796c77454a8893e4)
---
src/misc/ios/SDL_sysurl.m | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/misc/ios/SDL_sysurl.m b/src/misc/ios/SDL_sysurl.m
index e90c23f90f488..f8020585081cb 100644
--- a/src/misc/ios/SDL_sysurl.m
+++ b/src/misc/ios/SDL_sysurl.m
@@ -26,16 +26,17 @@
int SDL_SYS_OpenURL(const char *url)
{
@autoreleasepool {
-
NSString *nsstr = [NSString stringWithUTF8String:url];
NSURL *nsurl = [NSURL URLWithString:nsstr];
if (![[UIApplication sharedApplication] canOpenURL:nsurl]) {
return SDL_SetError("No handler registerd for this type of URL");
}
- if (@available(iOS 10.0, *)) {
+ if (@available(iOS 10.0, tvOS 10.0, *)) {
[[UIApplication sharedApplication] openURL:nsurl options:@{} completionHandler:^(BOOL success) {}];
} else {
+ #ifndef SDL_PLATFORM_VISIONOS /* Fallback is never available in any version of VisionOS (but correct API always is). */
[[UIApplication sharedApplication] openURL:nsurl];
+ #endif
}
return 0;
}