gpt4 book ai didi

ios - 我的 fileExistsAtPath 语句在应该为 true 时返回 false

转载 作者:行者123 更新时间:2023-11-30 13:09:09 26 4
gpt4 key购买 nike

我正在使用以下代码在我的用户设备上检索收据:

let receiptUrl = NSBundle.mainBundle().appStoreReceiptURL

然后我使用以下命令检查receiptURL 的值:

print("receiptUrl is \(receiptUrl)")

我的控制台将位置显示为:

receiptUrl is Optional(file:///private/var/mobile/Containers/Data/Application/018CF51F-1F55-465B-AA98-B4AD5A864E06/StoreKit/sandboxReceipt)

然后我使用 if 语句:

if NSFileManager.defaultManager().fileExistsAtPath(receiptUrl!.path!)
{ //do great security stuff
}

但是,我的 fileExistsAtPath 始终返回 false。非常令人沮丧。

最佳答案

这可能是正确的结果。 appStoreReceiptURL 不显示存在路径。只需出示商店收据文件夹就会在那里。这个答案与 this 相关

关于ios - 我的 fileExistsAtPath 语句在应该为 true 时返回 false,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38942720/

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