我正在使用SwiftyStoreKit
并弄清楚如何检索收据验证的状态。我想status
从receiptInvalid(receipt: ["status": 21004, "environment": Sandbox], status: SwiftyStoreKit.ReceiptStatus.secretNotMatching)
. 我将如何获得价值21004?
receiptInvalid
是最后一种情况的结果:
public enum ReceiptError: Swift.Error {
// No receipt data
case noReceiptData
// No data received
case noRemoteData
// Error when encoding HTTP body into JSON
case requestBodyEncodeError(error: Swift.Error)
// Error when proceeding request
case networkError(error: Swift.Error)
// Error when decoding response
case jsonDecodeError(string: String?)
// Receive invalid - bad status returned
case receiptInvalid(receipt: ReceiptInfo, status: ReceiptStatus)
}
收据信息:
public typealias ReceiptInfo = [String: AnyObject]
最终目标是为 Apple App Review 测试代码21007。谢谢!
编辑:注释所在的位置是什么代码?
case .error(let error):
print("Receipt verification failed: \(error)")
//error prints receiptInvalid(receipt: ["status": 21004, "environment": Sandbox], status: SwiftyStoreKit.ReceiptStatus.secretNotMatching)
if case .receiptInvalid = error {
//What goes here?
}