Skip to content

Commit

Permalink
修复isiOSAppOnMac判断错误,导致MacCatalystApp无法使用的问题 (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiasongs authored Jun 26, 2024
1 parent 448d36d commit ae39613
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Src/Main/Server/Connection/LKS_ConnectionManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,14 @@ - (BOOL)isiOSAppOnMac {
if (@available(iOS 14.0, *)) {
// isiOSAppOnMac 这个 API 看似在 iOS 14.0 上可用,但其实在 iOS 14 beta 上是不存在的、有 unrecognized selector 问题,因此这里要用 respondsToSelector 做一下保护
NSProcessInfo *info = [NSProcessInfo processInfo];
if ([info respondsToSelector:@selector(isiOSAppOnMac)]) {
return [info isiOSAppOnMac];
} else if ([info respondsToSelector:@selector(isMacCatalystApp)]) {
return [info isMacCatalystApp];
if ([info respondsToSelector:@selector(isiOSAppOnMac)] && [info isiOSAppOnMac]) {
return YES;
} else if ([info respondsToSelector:@selector(isMacCatalystApp)] && [info isMacCatalystApp]) {
return YES;
} else {
return NO;
}
}
if (@available(iOS 13.0, tvOS 13.0, *)) {
} else if (@available(iOS 13.0, tvOS 13.0, *)) {
return [NSProcessInfo processInfo].isMacCatalystApp;
}
return NO;
Expand Down

0 comments on commit ae39613

Please sign in to comment.