赞
踩
由于这只能在正式环境上重现,可以代码调试的沙盒测试是不行的,只能通过猜测和上线调试代码才能验证问题
- var data = new Dictionary<string, object>
- {
- { "receipt_data", transactionResult.receipt },
- };
- //将内购信息转发到服务器收集查询
- ServerManager.instance.SendToUrl("purchase/receipts", "POST", data, jObject =>
- {
- var statusToken = jObject["status"];
- if (statusToken.IsNullOrEmpty())
- {
- callback(false);
- return;
- }
- var status = (int)statusToken;
- callback(status == 0);
- });
复制
通过收据内容就可以分析。 最后发现,客户端的内购没有回调
- //内购状态回调
- -(void) paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
复制
继续往下分析
由于代码是IOSNative的,找了一些主流的内购插件,甚至Unity自带的Unity IAP,底层原理都一样,还是无法解决问题,所以需要自己去写OC代码,把内购信息从OC转发到C#去验证
- #import <Foundation/Foundation.h>
- #import <StoreKit/StoreKit.h>
-
-
- NSString *managerName = @"IAPManager";
- NSString *initSucceedFuncName = @"OnInitSucceed";
- NSString *transactionFuncName = @"OnTransactionCompleted";
- NSString *restoreCompleteFuncName = @"OnRestoreCompleted";
- NSString *splitString = @"-";
-
- @interface IAPManager : NSObject<SKProductsRequestDelegate, SKPaymentTransactionObserver>
- {
- SKProductsRequest *productsRequest;
- NSArray *products;
- }
-
- -(void)initIAP;
- -(void)buy:(NSString *)productIdentifier;
- -(void)restore;
-
- @end
-
- @implementation IAPManager
- IAPManager *iapManager = nil;
- //初始化, 商品id用,分隔
- -(void) initIAP:(NSString *)productIdentifiers
- {
- [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
- NSArray *idArra
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。