gpt4 book ai didi

macos - 如何检查 Mac 计算机上是否安装了应用程序的多个版本

转载 作者:行者123 更新时间:2023-12-03 16:54:37 25 4
gpt4 key购买 nike

我需要检查 Mac 计算机上是否安装了应用程序的多个版本。

我需要检查 Mac 计算机上是否安装了多个版本的 Google Chrome,并且

使用最新版本的 Google Chrome 打开网址。

最佳答案

NSURL *url = [[NSURL alloc] initWithScheme:@"http" host:@"example.host.com" path:@"/example"];

CFArrayRef finds = LSCopyApplicationURLsForURL (
(CFURLRef) url,
kLSRolesAll
) ;// all web applications

for(int i=0;i<CFArrayGetCount(finds);i++)
{
CFURLRef appURL = CFArrayGetValueAtIndex(finds,i);
MDItemRef item = MDItemCreateWithURL(kCFAllocatorDefault, appURL);
CFTypeRef itemVersion = MDItemCopyAttribute(item, kMDItemVersion);// version
NSLog(@"appURL %@ itemVersion %@",appURL,itemVersion);
}

//appURL file://localhost/Applications/Google%20Chrome.app/ itemVersion 30.0.1599.101

关于macos - 如何检查 Mac 计算机上是否安装了应用程序的多个版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19422867/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com