macOS - 众神在惩罚我。无论我做什么,应用程序的收据都无法加载

macOS - The Gods are punishing me. The app's receipt fails miserably to load, no matter what I do

我已经在 SO 上针对类似问题测试了所有解决方案,但它们对我来说都失败了。

我认为我的不同,因为应用程序的收据甚至没有加载。

我已经开发这个 macOS 应用程序至少 7 个月了。该应用包含自动续订订阅。

从第一天开始,我就成功地检索并验证了它的收据。完全没有问题。那是好日子。

2020 年 1 月 3 日,我又开始开发应用程序了。

从那以后,该应用程序甚至无法加载收据。代码没有变化,什么都没有。

即使像这样从 Apple 复制的简单代码也会失败。

// Get the receipt if it's available
if let appStoreReceiptURL = Bundle.main.appStoreReceiptURL,
    FileManager.default.fileExists(atPath: appStoreReceiptURL.path) {

    do {
        let receiptData = try Data(contentsOf: appStoreReceiptURL, options: .alwaysMapped)
        print(receiptData)

        let receiptString = receiptData.base64EncodedString(options: [])

        // Read receiptData
    }
    catch { print("Couldn't read receipt data with error: " + error.localizedDescription) }
} else {      
  exit(173)
  print("this error stinks!")
}

这一行

FileManager.default.fileExists(atPath: appStoreReceiptURL.path)

惨败。收据不存在。

这是我目前尝试过的方法:

  1. 哭泣
  2. 重启电脑
  3. 删除~/Library/Caches/com.apple.appstore
  4. 创建一个新的沙盒用户
  5. 尝试使用多年前创建的旧沙箱用户。
  6. 重新安装Xcode
  7. 退出 App Store 和 iCloud + 重新启动计算机。
  8. 终止 storeaccountd 守护进程 + 重新启动。
  9. 确认 Info.plist 上的版本和 bundleID 与 appstoreConnect 中的相同。

我得到的一切都是

networkError(error: Error Domain=SKErrorDomain Code=0 "(null)")

exit(173) 被触发,我输入沙箱用户然后我得到

The app is damaged and can’t be opened. Delete the app and download it again from the App Store.

我在 10 年前开发的 iOS 设备应用程序上遇到过这个问题,我设法解决这个问题的唯一方法是将设备重置为出厂默认设置。此致,我不会重装 macOS。

我很绝望。这两天老了20岁

是否有某些缓存或 macOS 服务可能会被阻塞?

我注意到的一件事是,当您尝试购买应用程序内购买时,用于键入 App Store 凭据的弹出框不会显示单词 sandbox 作为弹出框,并且这boxes 总是预先填充了一个旧的沙箱用户。有办法清理吗?

还有其他想法吗?

我已向 Apple 提出技术问题,但他们无法解决。

有人建议我解决问题的唯一方法:在同一个 Mac 上创建另一个用户并从那里进行测试。

问题已解决

如果您在 iOS 遇到此问题,解决方法是将设备重置为出厂默认设置。


注意:显然,这一次,整个问题是由 Apple 造成的,在 half cooked update 到他们的 sandbox/production 服务器之后。