gpt4 book ai didi

ios - 应用内购买 appStoreReceiptURL 为空

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:05:53 26 4
gpt4 key购买 nike

2 个月前,我在我的应用程序中进行了自动续订购买,沙盒一切正常。但是现在我无法通过 NSBundle.mainBundle().appStoreReceiptURL 获得收据,这条路径不会退出。怎么可能? 2 个月前(或更短)有收据。请帮帮我!这就是我获得收据的方式(swift 2)-

static func receipt() -> String {
print("RECEPT URL", NSBundle.mainBundle().appStoreReceiptURL)

guard let receiptUrl = NSBundle.mainBundle().appStoreReceiptURL, let receiptPath = receiptUrl.path else { return "" }
let fileManager = NSFileManager.defaultManager()
if fileManager.fileExistsAtPath(receiptPath){
var receiptData: NSData?
do {
receiptData = try NSData(contentsOfURL: receiptUrl, options: NSDataReadingOptions.DataReadingMappedAlways)
}
catch {
print("ERROR: " )
}

//guard let receiptData = NSData(contentsOfURL: receiptUrl) else { return "" }
if let receiptString = receiptData?.base64EncodedStringWithOptions(NSDataBase64EncodingOptions(rawValue: 0)) {
print("REC", receipt, receiptString)

return receiptString
}
}
return ""
}

最佳答案

根据文档,appStoreReceiptURL可能会或可能不会指向与收据一起归档。您可以使用 SKReceiptRefreshRequest 请求收据刷新.

关于ios - 应用内购买 appStoreReceiptURL 为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47620812/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com