Mac文件关联不起作用.为什么或如何调试? [英] Mac File association not working. Why or how to debug?

查看:95
本文介绍了Mac文件关联不起作用.为什么或如何调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下Info.plist,我正在尝试将.mybin文件与应用程序相关联.但是,安装.mybin文件后,没有图标,描述或关联(使用获取信息"查看时).我是OSX开发的新手,并且继承了应用程序的包装,因此我不知道如何调试问题.如果有任何区别,则使用productbuild将应用程序打包为.app.

I have the following Info.plist which I am attempting to associate .mybin files with the applcation. However after installing the .mybin files do not have the icon, the description or the association (when viewing with Get Info). I'm completely new to OSX development and I inherited the packaging of the application so I have no idea how to debug problems. The app is packaged to a .app using productbuild if that makes any difference.

我已经将我的info.plist与其他几个应用程序进行了比较,我唯一看到的区别是许多包含已弃用的密钥,例如CFBundleTypeExtensions.因为我只需要支持10.6和更高版本,所以我认为我不需要它,而LSItemContentTypes应该足够了.据我了解,LSItemContentTypes的"com.me.myapp.mybin"是指向相同名称的已导出UTI的链接.

I have compared my info.plist against several other applications and the only difference I can see is many include deprecated keys such as CFBundleTypeExtensions. Since I only need to support 10.6 and greater I don't believe I need this and LSItemContentTypes should be enough. From what I understand the 'com.me.myapp.mybin' of LSItemContentTypes is the link to the exported UTI of the same name.

我尝试手动将.mybin文件与应用程序相关联,但是当我双击说该应用程序无法处理该类型的文件时,该操作将失败.

I have tried manually associating the .mybin file with the application, but that fails when I double-click saying the app does not handle that type of file.

任何人都可以告诉我们此info.plist有什么问题或要怎么做吗?

Can anyone tell we what is wrong with this info.plist or what to do investigate?

谢谢.

<plist version="1.0">
<dict>
    <key>CFBundleIconFile</key>
    <string>MyApp.icns</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleGetInfoString</key>
    <string>My Application version 1.0, Copyright © 2013.</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleExecutable</key>
    <string>My Application</string>
    <key>CFBundleName</key>
    <string>My Application</string>
    <key>LSMinimumSystemVersion</key>
    <string>10.6</string>
    <key>CFBundleIdentifier</key>
    <string>com.me.myapp</string>
    <key>CFBundleDisplayName</key>
    <string>My Application</string>
    <key>CFBundleVersion</key>
    <string>1.0.0</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0.0</string>
    <key>LSMultipleInstancesProhibited</key>
    <true/>
    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeIconFile</key>
            <string>MyApp</string>
            <key>CFBundleTypeName</key>
            <string>My Application binary</string>
            <key>CFBundleTypeRole</key>
            <string>Viewer</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>com.me.myapp.mybin</string>
            </array>
            <key>LSHandlerRank</key>
            <string>Owner</string>
        </dict>
    </array>
    <key>UTExportedTypeDeclarations</key>
    <array>
        <dict>
            <key>UTTypeConformsTo</key>
            <array>
                <string>public.data</string>
            </array>
            <key>UTTypeDescription</key>
            <string>My Application binary</string>
            <key>UTTypeIconFile</key>
            <string>MyApp.icns</string>
            <key>UTTypeIdentifier</key>
            <string>com.me.myapp.mybin</string>
            <key>UTTypeTagSpecification</key>
            <dict>
                <key>public.filename-extension</key>
                <string>mybin</string>
                <key>public.mime-type</key>
                <string>application/vnd.me-app.binary</string>
            </dict>
        </dict>
    </array>
</dict>
</plist>

推荐答案

您可以使用lsregister命令进行调查:

You could investigate using the lsregister command:

alias lsregister='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister'
lsregister -lint -f /path/to/your.app

(我使用的是Lion.在Mac OS的其他版本上,lsregister的路径可能不同.)

(I'm using Lion. On a different version of the Mac OS, it's possible that the path to lsregister is different.)

这篇关于Mac文件关联不起作用.为什么或如何调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆