是什么导致OS X应用因错误"LSOpenURLsWithRole()失败,错误-10810"而无法打开? [英] What makes an OS X app not open with the error "LSOpenURLsWithRole() failed with error -10810"?

查看:84
本文介绍了是什么导致OS X应用因错误"LSOpenURLsWithRole()失败,错误-10810"而无法打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究应该是一个非常简单的OS X应用程序捆绑包.我的OS是10.7.5版.在这种情况下,该应用是外壳脚本.

I am working on what should be a very simple application bundle for OS X. My OS is version 10.7.5. The app in this case is a shell script.

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 :

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

当我尝试打开应用程序时,出现以下错误消息:

When I try to open the app I get the following error message:

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

脚本设置为+ x.我已经看到有关SuperUser的问题,但没有任何帮助-我的脚本超过27个字符.

The script is set +x. I have seen this question on SuperUser but nothing there helped - my script is over 27 characters.

按照另一个问题中的说明 来为我的应用重建Launch Services数据库后,尝试打开它现在产生:

After following the instructions in this other question to rebuild the Launch Services database for my app, trying to open it now produces:

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

推荐答案

我做了一些测试,并能够重现第二个错误.

I did some testing, and was able to reproduce your second error.

LSOpenURLsWithRole()失败,文件/PATH/TO/Kerkerkruip.app出现错误-10810.

LSOpenURLsWithRole() failed with error -10810 for the file /PATH/TO/Kerkerkruip.app.

经过实验,看来问题出在您的shell脚本退出,错误代码为 1 .如果您以成功代码 0 退出 exit ,则不会发生该错误.

After experimentation, it looks like the issue is caused by your shell script exiting with the error code of 1. If you exit with the success code of 0, the error does not occur.

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

这篇关于是什么导致OS X应用因错误"LSOpenURLsWithRole()失败,错误-10810"而无法打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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