c++ - Xcode - Mac App - 启动时 Bootstrap 检查错误

标签 c++ xcode macos opengl

我正在使用 Xcode 创建一个 C++ Mac 应用程序。我以前做过这个没有任何问题,但几周前我开始了一个新项目,这个项目有问题。

发布消息

当我启动应用程序时,调用 SDL_GL_CreateContext 后控制台中会出现此消息

bootstrap_check_in():  (os/kern) unknown error code (44c)

我以前从没见过这个,我不知道它是什么意思。不过,该应用仍会启动。

打开弹窗

osascript 不再有效。调用此命令时,

osascript  -e 'try' -e 'POSIX path of ( choose file name with prompt "Save screenshot" default name "Screenshot.png" )' -e 'on error number -128' -e 'end try'

此消息出现在控制台中:

2017-11-25 10:50:19.837159+1030 osascript[7910:487965] +[NSXPCSharedListener endpointForReply:withListenerName:]: an error occurred while attempting to obtain endpoint for listener 'com.apple.view-bridge': Connection interrupted
2017-11-25 10:50:19.838056+1030 osascript[7910:487963] *** Assertion failure in +[NSXPCSharedListener connectionForListenerNamed:fromServiceNamed:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/ViewBridge/ViewBridge-341.1/NSXPCSharedListener.m:421
2017-11-25 10:50:19.838724+1030 osascript[7910:487963] *** Assertion failure in -[NSVBSavePanel viewWillInvalidate:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.10.101/Nav.subproj/OpenAndSavePanelRemote/NSVBOpenAndSavePanels.m:387
2017-11-25 10:50:19.879032+1030 osascript[7910:487963] -[NSVBSavePanel init] caught non-fatal NSInternalInconsistencyException 'bridge absent' with backtrace

我已经排除了堆栈跟踪。如果您希望我包含堆栈跟踪,请发表评论。

随机消息

有时控制台中会出现另一条消息。

2017-11-26 11:09:14.994459+1030 Buttons[28532:1663094] [User Defaults] Couldn't read values in CFPrefsPlistSource<0x6000000e6b80> (Domain: com.apple.PowerManagement, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access, detaching from cfprefsd

路径

调用 SDL_GetPrefPath 在此应用程序中产生不同的路径。

这个应用

SDL_GetPrefPath("company", "my app") -> "/Users/indikernick/Library/Containers/company.my-app/Data/Library/Application Support/company/my app/"

另一个未损坏的应用程序

SDL_GetPrefPath("company", "my app") -> "/Users/indikernick/Library/Application Support/company/my app/"

就这些

我很确定所有这些问题都是相关的。该项目在Github因此,如果您在检查项目设置之前已经看到此问题。如果重要的话,我使用的是 Xcode 9.0 和 MacOS 10.13.1

提前感谢您的帮助。

最佳答案

看起来您的应用程序(以某种方式)被沙盒化了。从 SDL_GetPrefPath 返回的路径(以 ~/Library/Containers 开头)和“随机”消息中可以看出这一点,该消息明确指出:

accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access

弹出的错误消息也很可疑:您的应用似乎无权访问某些系统资源。

如果您的应用程序启用了沙盒,您应该检查 xcode(即检查项目导航器中是否显示名为 .entitlements 的属性列表文件)。

关于沙盒的更多信息:https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html

关于c++ - Xcode - Mac App - 启动时 Bootstrap 检查错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47481602/

相关文章:

objective-c - 自动保存期间 Cocoa 应用程序错误(errno 66)

objective-c - AVPlayerLooper 不会循环播放多个视频

c++ - 如何使用 `cc_common.create_link_variables` API?

c++ - 不间断地从循环中删除列表中的元素

c++ - 模板 vector

iphone - 可以将 if 语句放在#define 中吗?

ios - 如何从自定义 UICollectionViewCell 启动 View Controller

xcode - Facebook SDK 4.0.1 Swift 错误 xcode 6.2 iOS 8.2

macos - 有没有办法对 go os.exec 调用进行 chroot/sandbox(防止 rm -rf/)

c++ - 提升 ASIO : SSL handshake() never finishes