iOS9: fix crash fetching refresh rate

This commit is contained in:
Eric Warmenhoven 2025-06-16 10:02:43 -04:00
parent 9595904af1
commit dbd5e89149
2 changed files with 10 additions and 2 deletions

View File

@ -150,7 +150,12 @@ static void *apple_display_server_get_resolution_list(
[rates addObjectsFromArray:@[@(24), @(30), @(40), @(48), @(60), @(120)]];
else
#endif
[rates addObject:@(mainScreen.maximumFramesPerSecond)];
{
if (@available(iOS 10.3, tvOS 10.2, *))
[rates addObject:@(mainScreen.maximumFramesPerSecond)];
else
[rates addObject:@(60)];
}
#endif
NSArray *sorted = [[rates allObjects] sortedArrayUsingSelector:@selector(compare:)];

View File

@ -242,7 +242,10 @@ static float cocoa_gl_gfx_ctx_get_refresh_rate(void *data)
CFRelease(currentMode);
return currentRate;
#else
return [UIScreen mainScreen].maximumFramesPerSecond;
if (@available(iOS 10.3, tvOS 10.2, *))
return [UIScreen mainScreen].maximumFramesPerSecond;
else
return 60;
#endif
}