unibillStoreKit.mm - 未声明的标识符 SKPaymentTransactionStateDeferred - unibill 专家?

unibillStoreKit.mm - undeclared identifier SKPaymentTransactionStateDeferred - unibill expert?

这是我第一次在我的 ios 游戏中使用 unibill,当我尝试在设备上构建和 运行 我的应用程序时遇到了问题。

我收到消息,在 SKPaymentTransactionStateDeferred 案例中使用了未声明的标识符:(我没有更改 unibill 插件源代码中的任何内容)所以我不确定该怎么做。

我不能 post 图片所以我 post 下面的代码。请在线观看XCODE ISSUE.

// The transaction status of the SKPaymentQueue is sent here.
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray*)transactions {
    NSLog(@"Unibill: updatedTransactions");
    for(SKPaymentTransaction *transaction in transactions) {
        switch (transaction.transactionState) {

            case SKPaymentTransactionStatePurchasing:
                // Item is still in the process of being purchased
                break;

            case SKPaymentTransactionStatePurchased:
            case SKPaymentTransactionStateRestored: {
                // Item was successfully purchased or restored.
                NSMutableDictionary* dic;
                dic = [[NSMutableDictionary alloc] init];
                [dic setObject:transaction.payment.productIdentifier forKey:@"productId"];

                [dic setObject:[self selectReceipt:transaction]  forKey:@"receipt"];

                NSData* data;
                data = [NSJSONSerialization dataWithJSONObject:dic options:0 error:nil];
                NSString* result;
                result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

                UnitySendMessage(UNITY_GAMEOBJECT_NAME, "onProductPurchaseSuccess", result.UTF8String);
#if !__has_feature(objc_arc)
                [result release];
                [dic release];
#endif

                // After customer has successfully received purchased content,
                // remove the finished transaction from the payment queue.
                [[SKPaymentQueue defaultQueue] finishTransaction: transaction];
                break;
            }

            case SKPaymentTransactionStateDeferred: 
 **//XCODE ISSUE: USE OF UNDECLARED IDENTIFIER   "SKPaymentTransactionStateDeferred"**
                NSLog(@"Unibill: purchaseDeferred");
                UnitySendMessage(UNITY_GAMEOBJECT_NAME, "onProductPurchaseDeferred", transaction.payment.productIdentifier.UTF8String);
                break;
            case SKPaymentTransactionStateFailed:
                // Purchase was either cancelled by user or an error occurred.

                NSString* errorCode = [NSString stringWithFormat:@"%d",transaction.error.code];
                if (transaction.error.code != SKErrorPaymentCancelled) {
                    NSLog(@"Unibill: purchaseFailed: %@", errorCode);
                    UnitySendMessage(UNITY_GAMEOBJECT_NAME, "onProductPurchaseFailed", transaction.payment.productIdentifier.UTF8String);
                } else {
                    NSLog(@"Unibill: purchaseFailed: %@", errorCode);
                    UnitySendMessage(UNITY_GAMEOBJECT_NAME, "onProductPurchaseCancelled", transaction.payment.productIdentifier.UTF8String);
                }

                // Finished transactions should be removed from the payment queue.
                [[SKPaymentQueue defaultQueue] finishTransaction: transaction];
                break;
        }
    }
}

有人知道我该怎么做吗?另一个问题:在哪里可以找到 unibillstorekit.mm 文件中调用的案例的声明?或者我必须在哪里声明这个标识符?

如果您需要更具体的信息,请告诉我。

注意:我只是一个初学者:)

您是否更改了部署目标?

问题可能是由于您的部署目标指向 iOS 低于 8.0 的版本。 SKPaymentTransactionStateDeferred 仅适用于大于 8 的 iOS 版本。因此,如果您的部署目标设置为例如7.1 你会 运行 进入这个错误。

要摆脱这种情况,您只需将部署目标更新为大于或等于 8.0,或者分别使用另一个(较旧)版本的库或插件

希望对您有所帮助。