【问题标题】:CFBundleTypeIconFile Icon not showing for given file extensionCFBundleTypeIconFile 图标未显示给定文件扩展名
【发布时间】:2016-04-13 23:28:09
【问题描述】:

我的应用程序有以下 Info.plist,问题是我使用扩展名 myapp 保存的文件似乎没有在我从图标集创建的 MyApp 图标上找到(应用程序正确使用图标)所以猜测plist 中有问题。

我假设如果我在运行我的应用程序时得到这个工作,我保存的文档会突然显示给定的图标。

如果这很重要,文档是从一组基于 NSCoder 的类中保存的。单击这些文档也会打开我的应用程序并正确加载文件,所以很困惑我缺少什么让图标显示在文件上......

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeExtensions</key>
            <array>
                <string>myapp</string>
            </array>
            <key>CFBundleTypeIconFile</key>
            <string>MyApp</string>
            <key>CFBundleTypeOSTypes</key>
            <array>
                <string>ASWM</string>
            </array>
            <key>CFBundleTypeName</key>
            <string>MyApp project file</string>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
        </dict>
    </array>
    <key>CFBundleExecutable</key>
    <string>${EXECUTABLE_NAME}</string>
    <key>CFBundleIconFile</key>
    <string>MyApp</string>
    <key>CFBundleIdentifier</key>
    <string>com.workmonkeys.${PRODUCT_NAME:rfc1034identifier}</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>${PRODUCT_NAME}</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>ASWM</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>LSApplicationCategoryType</key>
    <string>public.app-category.developer-tools</string>
    <key>LSMinimumSystemVersion</key>
    <string>${MACOSX_DEPLOYMENT_TARGET}</string>
    <key>NSHumanReadableCopyright</key>
    <string>Copyright © 2012 Me. All rights reserved.</string>
    <key>NSMainNibFile</key>
    <string>MainMenu</string>
    <key>NSPrincipalClass</key>
    <string>NSApplication</string>
</dict>
</plist>

【问题讨论】:

    标签: macos cocoa


    【解决方案1】:

    当我最初创建我的应用程序时,系统一定已经缓存了 plist 的旧副本。所需要的只是重建启动服务数据库。

    我使用了此处记录的 lsregister 命令...

    http://www.tuaw.com/2009/06/11/terminal-tips-rebuild-your-launch-services-database-to-clean-up/

    重新运行应用程序并宾果游戏文档现在具有相关联的相应图标。

    【讨论】:

      猜你喜欢
      • 2016-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-24
      • 2015-11-05
      • 2012-02-13
      • 2015-01-20
      • 2015-10-16
      相关资源
      最近更新 更多