标签: storekittest

SKReceiptRefreshRequest 在带有 .storekit 配置文件的 Xcode 12.2 中总是失败

当我.storekit在 Xcode 12.2 / iOS 14.2 Simulator 中使用配置文件运行应用程序时,我SKReceiptRefreshRequest总是失败,我的func request(_ request: SKRequest, didFailWithError error: Error)委托方法出现错误。以下是日志:

# Printed by some Apple internal framework:

<SKReceiptRefreshRequest: 0x60000320d640>: Finished refreshing receipt with error: Error Domain=ASDServerErrorDomain Code=5002 "Unhandled exception" UserInfo={NSLocalizedDescription=Unhandled exception, NSLocalizedFailureReason=An unknown error occurred}

# Error logged by my code:

Failed to refresh app receipt: Error Domain=SKErrorDomain Code=0 "UNKNOWN_ERROR" UserInfo={NSLocalizedDescription=UNKNOWN_ERROR, NSUnderlyingError=0x600003c9a040 {Error Domain=ASDServerErrorDomain Code=5002 "Unhandled exception" UserInfo={NSLocalizedDescription=Unhandled exception, NSLocalizedFailureReason=An unknown error occurred}}}
Run Code Online (Sandbox Code Playgroud)

我像往常一样运行请求:

class ReceiptFetcher: NSObject {

    func fetchReceipt() …
Run Code Online (Sandbox Code Playgroud)

xcode storekit ios storekittest

8
推荐指数
1
解决办法
877
查看次数

UITest 的 Storekit 配置文件

我创建了Configuration.storekit文件,它适用于在 ios 模拟器上运行。但是当我尝试运行 UITest 时,它总是在初始化时失败SKTestSession(configurationFileNamed: "Configuration")并出现错误:

caught error: "Error Domain=SKTestErrorDomain Code=4 "File not found" UserInfo={NSLocalizedDescription=File not found}"
Run Code Online (Sandbox Code Playgroud)

这是我的代码

import XCTest
import StoreKitTest

class MyProjectUITests: XCTestCase {

    override func setUpWithError() throws {
        continueAfterFailure = false
    }

    override func tearDownWithError() throws {
        
    }

    func testExample() throws {
        if #available(iOS 14.0, *) {
            let session = try SKTestSession(configurationFileNamed: "Configuration")
            session.disableDialogs = true
            session.clearTransactions()
        }
        // UI tests
        
        *****
        
    }
}
Run Code Online (Sandbox Code Playgroud)

如果我尝试@testable import MyProject失败并出现另一个错误:

Missing required modules: 'Amplitude', …
Run Code Online (Sandbox Code Playgroud)

swift uitest storekittest

6
推荐指数
1
解决办法
1278
查看次数

标签 统计

storekittest ×2

ios ×1

storekit ×1

swift ×1

uitest ×1

xcode ×1