【问题标题】:Mac App Development: "***.app" is damaged and can't be openedMac App开发:“***.app”已损坏,无法打开
【发布时间】:2021-01-08 12:48:24
【问题描述】:

我有一段时间没有接触过的 Mac 应用程序。现在,it appears that something around running apps with Mac App Store integrations has changed since macOS Catalina。

当我从 XCode 启动应用程序时,它会崩溃并显示退出代码 173 并记录如下,然后提示使用我的 Apple ID 登录,我尝试将这两种生活都作为沙盒 Apple ID。

无论我使用哪个 Apple ID 登录,都会以错误结尾:«“Appname”已损坏,无法打开。»

日志

Could not check for receipt presence for some reason... Error Domain=NSCocoaErrorDomain Code=260 "The file “receipt” couldn’t be opened because there is no such file." UserInfo={NSURL=Contents/_MASReceipt/receipt -- file:///Users/******/Library/Developer/Xcode/DerivedData/*********-egqjyklohxjyjqcvtxjmwzdxvxhv/Build/Products/Debug/**********.app/, NSFilePath=/Users/******/Library/Developer/Xcode/DerivedData/*********-egqjyklohxjyjqcvtxjmwzdxvxhv/Build/Products/Debug/**********.app/Contents/_MASReceipt/receipt, NSUnderlyingError=0x600000c86310 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
2021-01-08 13:23:07.867823+0100 *********s[87637:4910885] Failed fetch receipt with error: The file “receipt” couldn’t be opened because there is no such file.
Could not check for receipt presence for some reason... Error Domain=NSCocoaErrorDomain Code=260 "The file “receipt” couldn’t be opened because there is no such file." UserInfo={NSURL=Contents/_MASReceipt/receipt -- file:///Users/******/Library/Developer/Xcode/DerivedData/*********-egqjyklohxjyjqcvtxjmwzdxvxhv/Build/Products/Debug/**********.app/, NSFilePath=/Users/******/Library/Developer/Xcode/DerivedData/*********-egqjyklohxjyjqcvtxjmwzdxvxhv/Build/Products/Debug/**********.app/Contents/_MASReceipt/receipt, NSUnderlyingError=0x600000c8dd40 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
2021-01-08 13:23:07.869011+0100 *********s[87637:4910885] Failed fetch receipt with error: The file “receipt” couldn’t be opened because there is no such file.
Could not reach receipt URL: Optional(Error Domain=NSCocoaErrorDomain Code=260 "The file “receipt” couldn’t be opened because there is no such file." UserInfo={NSURL=Contents/_MASReceipt/receipt -- file:///Users/******/Library/Developer/Xcode/DerivedData/*********-egqjyklohxjyjqcvtxjmwzdxvxhv/Build/Products/Debug/**********.app/, NSFilePath=/Users/******/Library/Developer/Xcode/DerivedData/*********-egqjyklohxjyjqcvtxjmwzdxvxhv/Build/Products/Debug/**********.app/Contents/_MASReceipt/receipt, NSUnderlyingError=0x600000c8ddd0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}})
2021-01-08 13:23:07.882384+0100 *********s[87637:4910885] No receipt found! Will exit with 173 to let macOS handle renewing a receipt from the App Store.

设置

  • macOS 10.15.7 (19H114)
  • XCode 12.3 (12C33) // 也用 XCode 11.7 尝试过 → 相同
  • 使用有效的开发证书签名的应用

【问题讨论】:

  • 好吧,社区没有回答我的问题。通过我自己在应用程序项目中使用 5 年以上的代码和我的私有 Carthage 框架进行了大量挖掘和调试后,我意识到这些日志都是由我自己的代码生成的。事件 173 退出是由我自己按照 Apple 的Validating Receipts Locally Guide 实现的。
  • 经验教训:做好功课并为您的项目创建文档。 ??? ??? FutureMe 将对此表示感谢。

标签: xcode macos-catalina storekit mac-app-store


【解决方案1】:

您可以通过xattr 命令修改属性。有了它,你可以绕过例如你的错误信息或其他类似app cannot be opened as it wasn't installed from the AppStore。

无论如何,启动你的终端并使用:

sudo xattr -cr {path_to_application}/application.app

使用xattr,您可以通过应用查看扩展属性本身(并删除它们)

  1. -c 标志,用于删除所有属性
  2. 和-r 作用于目录树指向的所有文件。

对于这两个标志以及xattr,我建议阅读this documentation 页面。

【讨论】:

  • 感谢您的回答。虽然我确信您的解决方案适用于从任意来源使用的应用程序,但不幸的是,它不适合从 XCode 构建我的应用程序时的开发过程。
猜你喜欢
  • 1970-01-01
  • 2019-08-31
  • 1970-01-01
  • 2018-06-21
  • 2012-07-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-02-16
相关资源
最近更新 更多