Storekit implementation on Apple Watch?

丶灬走出姿态 提交于 2021-02-08 10:42:30

问题


Apple recently announced the ability to make purchases on the Apple Watch. I'm running Watch OS 6.2 and made a sandbox purchase on the iPhone, but there is no receipt on the watch (at least using Bundle.main.appStoreReceiptURL code below) Do we have to handle passing the receipt from the iPhone to the Watch ourselves? My understanding was that there would be an equivalent receipt saved on the watch we could parse.

    private func loadReceipt() -> Data? {
        guard let url = Bundle.main.appStoreReceiptURL else {
            return nil
        }

        do {
            let data = try Data(contentsOf: url)
            return data
        } catch {
            print("Error loading receipt data: \(error.localizedDescription)")
            return nil
        }
    }
}

来源:https://stackoverflow.com/questions/60511143/storekit-implementation-on-apple-watch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!