使用未解决的标识符"成功"使用SwiftyStoreKit

时间:2017-06-18 02:54:27

标签: ios swift3 storekit

我将myp项目从Swift 2.3升级到3。

来自SwiftyStoreKit' Github的示例代码:

.SwiftyStoreKit.purchaseProduct("com.musevisions.SwiftyStoreKit.Purchase1", quantity: 1, atomically: true) { result in
    switch result {
    case .success(let purchase):

我的代码:

func purchase(_ productId : String) {
        NetworkActivityIndicatorManager.NetworkOperationStarted()
        SwiftyStoreKit.purchaseProduct(productId, completion: {
            result in
            NetworkActivityIndicatorManager.networkOperationFinished()
            switch result
            {
            case success(let purchase):

(数量和原子上都有默认值):

public class func purchaseProduct(_ productId: String, quantity: Int = 1, atomically: Bool = true, applicationUsername: String = "", completion: @escaping (PurchaseResult) -> Void) {

为什么我在这里收到错误?enter image description here

1 个答案:

答案 0 :(得分:1)

<h1>current:{{ form.search.value()|default('') }} - jinja2 format</h1> <form action="." method="post"> {% csrf_token %} {{ form }} <button type="submit">submit</button> </form> 是枚举result的一个实例。因此,在您的交换机中,您在成功之前缺少PurchaseResult.

更改此行

PurchaseResult.

case success(let purchase):

case .success(let purchase):