Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: Fix SDL_OpenURL on newer iOS releases. #11730

Merged
merged 2 commits into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/misc/ios/SDL_sysurl.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,19 @@
bool SDL_SYS_OpenURL(const char *url)
{
@autoreleasepool {

#ifdef SDL_PLATFORM_VISIONOS
return SDL_Unsupported(); // openURL is not supported on visionOS
#else
NSString *nsstr = [NSString stringWithUTF8String:url];
NSURL *nsurl = [NSURL URLWithString:nsstr];
return [[UIApplication sharedApplication] openURL:nsurl];
#endif
if (![[UIApplication sharedApplication] canOpenURL:nsurl]) {
return SDL_SetError("No handler registerd for this type of URL");
}
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 true;
}
}

Expand Down
Loading