简体   繁体   English

在适用于macOS的Cocoa应用程序中,我使用NSFileWrapper将捆绑包保存到磁盘。 如何使取景器为我的捆绑包显示正确的图标?

[英]In a Cocoa Application for macOS, I save a bundle to disk using NSFileWrapper. How can I get the finder show the correct icon for my bundle?

In a Cocoa Application for macOS, I save a bundle to disk using NSFileWrapper. 在适用于macOS的Cocoa应用程序中,我使用NSFileWrapper将捆绑包保存到磁盘。 The Bundle is correctly saved and recognised as a bundle (Show package contents appear) but I cannot get the finder display the Icon I provide for the bundle. 捆绑软件已正确保存并识别为捆绑软件(出现“显示包装内容”),但我无法使取景器显示我为捆绑软件提供的图标。 Here are my settings for the imported/exported UTIs: 这是我导入/导出的UTI的设置:

在此处输入图片说明

Unfortunately, the bundle appears always with a blank file icon: 不幸的是,该捆绑包始终显示为带有空白文件图标:

在此处输入图片说明

As you can see, the Finder recognises the file kind, but does not display an image for it. 如您所见,Finder可以识别文件种类,但不会显示图像。 Any help is greatly appreciated. 任何帮助是极大的赞赏。 Thanks 谢谢

In the Exported UTIs section, try setting Conforms To to com.apple.package, public.archive . 在“ 导出的UTI”部分中,尝试将“ 符合于”设置 com.apple.package, public.archive

I'm no UTI expert, but that has always worked for my apps. 我不是UTI专家,但这一直适用于我的应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 macOS / Cocoa:用户将其移动到磁盘后,如何获取正在运行的应用程序主包的路径? - macOS / Cocoa: How to get the path of the running app's main bundle after the user moves it on disk? 如何为Mac OS X Bundle设置图标? - How can I set icon for Mac OS X Bundle? 如何在不使用单独的捆绑包的情况下将我的资源文件包含在框架中? - How can I include my resource files in my framework without using a separate bundle? 如何使用可可粉在我的Dock图标上绘制徽章? - How do I draw a badge on my Dock icon using Cocoa? 如何在Mac App Store上的os x应用程序中捆绑命令行实用程序(使用沙箱权利) - How can I bundle a command line utility in os x application on Mac App Store (using sandbox entitlement) 我可以从XCAssets包中获得NSURL吗? - Can I get a NSURL from an XCAssets bundle? 可可目标C-如何将图像数组转换为视频文件,并将其保存到磁盘? - Cocoa Objective C - How can i convert an array of images to a video file, and save it to disk? 如何检查是否可以使用NSError从捆绑读取图像? - how to check if i can read image from bundle using NSError? 如何在应用程序捆绑包中编辑文件? - How can I edit a file in app bundle? 如何获得Finder中使用的桌面图标? - How do I get the desktop icon used in Finder?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM