Dio*_*ion 0 xcode finder focus objective-c
我的mac应用程序中有一个小更新程序,它会自动下载带有最新版本应用程序的dmg文件.现在它也可以打开这个文件,但是如何关注Finder窗口呢?否则,用户不会知道狗文件被打开,因为它在后台.这是我下载和打开文件的代码:
NSData *fileData = [NSData dataWithContentsOfURL:
[NSURL URLWithString:@"http:// ... .dmg"]];
if([fileData writeToFile:@"/file.dmg" atomically:NO]) {
[[NSWorkspace sharedWorkspace] openFile:@"file.dmg"];
// Here I want to focus the new Finder window which has been opened by the code above
exit(1);
}
Run Code Online (Sandbox Code Playgroud)
你可以使用
[[NSWorkspace sharedWorkspace] openFile:myFile withApplication:@"Finder"];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
422 次 |
| 最近记录: |