Mac 菜单栏应用程序在应用程序启动时崩溃(仅作为公证应用程序):无法获取 /Applications/... 的文本偏移量(#3)没有这样的过程

问题描述 投票:0回答:1

我正在开发一个 Macos 菜单栏应用程序,由于某种原因,当我将应用程序存档、公证并导出到我的

Applications
文件夹并运行该应用程序时,它会立即崩溃。当我使用控制台应用程序时,我看到以下错误消息:

myapp[30188]: AppSandbox request successful

Channel could not return listener port.

activating connection: mach=false listener=false peer=false name=com.apple.hiservices-xpcservice

activating connection: mach=true listener=false peer=false name=com.apple.window_proxies

invalidated because the current process cancelled the connection by calling xpc_connection_cancel()

[app<application.com.myapp.15235459.15235465(501)>:30188] termination reported by launchd (2, 5, 5)

failed to fetch /Applications/myapp.app/Contents/_CodeSignature/CodeRequirements-1 error=-10

failed to get text offset for /Applications/myapp.app/Contents/MacOS/myapp[30188]: (#3) No such process

RBSStateCapture remove item called for untracked item 378-345-52811 (target:[app<application.com.myapp.15235459.15235465(501)>:30188])

当我在 Xcode 中运行应用程序(在调试模式和发布模式)时,除了 Sparkle 的这条消息之外,没有任何警告消息(我相对确定它与我的问题无关,但为了简洁起见,将其包含在此处):

Warning: Background app automatically schedules for update checks but does not implement gentle reminders. As a result, users may not take notice to update alerts that show up in the background. Please visit https://sparkle-project.org/documentation/gentle-reminders for more information. This warning will only be logged once.

Here

.app
文件二进制文件的链接。

我将应用程序的二进制文件交给了朋友,并在控制台应用程序中遇到了这些错误消息,但我自己无法重现它们。

Sandbox: myapp(9044) deny(1) file-read-data /Users/user/Downloads/myapp.app

IDENTITY_ATTRIBUTION: Failed to copy signing info for 9044, responsible for /private/var/folders/nt/40hq8tkx0tgb7c4fw5_n79wr0000gn/T/AppTranslocation/345F7E81-EE9E-4ADF-A66F-589A6647291D/d/myapp.app/Contents/MacOS/myapp: #-67065: Error Domain=NSOSStatusErrorDomain Code=-67065 "(null)"

我已尝试以下方法来阻止应用程序崩溃,但均无济于事:

  • 清理 Xcode
  • 删除 Xcode 派生数据
  • 重新启动Mac
  • 使用替代包标识符构建应用程序
  • 删除了 Sparkle 包并重新存档、经过公证的应用程序
  • 在 Xcode 项目 > 目标 > 签名中启用应用程序沙箱
  • 已将
    com.apple.security.automation.apple-events
    添加到应用程序权利文件
  • 用新生成的证书替换了钥匙串中的“开发者 ID 应用程序证书”
  • 使用 Xcode 手动签名而不是自动签名。 (创建开发、发布配置文件、应用程序 ID)

其他背景

  • Xcode 15.2
  • MacOS 索诺玛 14.5
  • Xcode 最低部署:13.0

包依赖项:

swift xcode macos
1个回答
0
投票

我自己使用“登录时启动”,所以我确信这不是问题。

这个苹果开发论坛线程有相同的错误,但 NSOSStatusErrorDomain 代码略有不同。我认为这与您遇到的问题非常相似。

根据 DTS 工程师的说法,这是一个签名问题。如果您还没有看过,请阅读:https://forums.developer.apple.com/forums/thread/678816

个人经历: 我不确定你遇到了什么问题,但是:

  1. 您确定使用了正确的应用程序文件吗?它通常在一个神秘文件夹中的同一个包中生成
  2. 您需要强化运行时功能,以便在 App Store 之外进行临时分发和公证。你检查过你是否需要或有这个吗?请参阅以下文档:https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/#3087727
© www.soinside.com 2019 - 2024. All rights reserved.