是什么导致 OS X 应用程序无法打开并出现错误“LSOpenURLsWithRole() 失败,错误 -10810”?

2024-04-29

我正在为 OS X 开发一个非常简单的应用程序包。我的操作系统版本是 10.7.5。本例中的应用程序是一个 shell 脚本。

Kerkerkruip.app/Contents/Info.plist https://github.com/i7/kerkerkruip/blob/master/packages/osx/Kerkerkruip.app/Contents/Info.plist:

<?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>CFBundleExecutable</key>
    <string>Kerkerkruip</string>
    <key>CFBundleIconFile</key>
    <string>Kicon.icns</string>
    <key>CFBundleIdentifier</key>
    <string>org.kerkerkruip.Kerkerkruip</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>Kerkerkruip</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <!--<key>CFBundleSignature</key>
    <string>????</string>-->
    <key>CFBundleVersion</key>
    <string>9.0.1</string>
    <key>LSMinimumSystemVersion</key>
    <string>10.4</string>
    <key>NSHumanReadableCopyright</key>
    <string>© 2011-2015 by the Kerkerkruip team</string>
    <!--<key>NSMainNibFile</key>
    <string>MainMenu</string>-->
    <!--<key>NSPrincipalClass</key>
    <string>NSApplication</string>-->
</dict>
</plist>

Kerkerkruip.app/Contents/MacOS/Kerkerkruip https://github.com/i7/kerkerkruip/blob/master/packages/osx/Kerkerkruip.app/Contents/MacOS/Kerkerkruip:

#!/usr/bin/env bash
echo "This is a blank script." 1>&2
exit 1

当我尝试打开该应用程序时,收到以下错误消息:

$ open Kerkerkruip.app/
The application cannot be opened because it has an incorrect executable format.

脚本设置为+x。我见过关于超级用户的这个问题 https://superuser.com/q/145675但没有任何帮助 - 我的脚本超过 27 个字符。

编辑:按照说明进行操作后在另一个问题中 https://stackoverflow.com/a/16546673/2854284为我的应用程序重建启动服务数据库,尝试打开它现在会产生:

LSOpenURLsWithRole() failed with error -10810 for the file /Users/dannii/Documents/kerkerkruip/packages/osx/Kerkerkruip.app.

我做了一些测试,并且能够重现您的第二个错误。

文件 /PATH/TO/Kerkerkruip.app 的 LSOpenURLsWithRole() 失败,错误为 -10810。

经过实验,问题似乎是由您的 shell 脚本退出引起的,错误代码为1。如果你exit成功代码为0,错误不会发生。

Example:

#!/usr/bin/env bash
echo "This is a blank script." 1>&2
exit 0
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

是什么导致 OS X 应用程序无法打开并出现错误“LSOpenURLsWithRole() 失败,错误 -10810”? 的相关文章

随机推荐