gpt4 book ai didi

objective-c - iOS 7 已弃用用于应用内购买的 transactionReceipt。我可以用什么代替它?

转载 作者:太空狗 更新时间:2023-10-30 03:11:14 27 4
gpt4 key购买 nike

在 iOS 7 中,在 SKPaymentTransaction 上类,属性transactionReceipt:

// Only valid if state is SKPaymentTransactionStatePurchased.

@property(nonatomic, readonly) NSData *transactionReceipt

…是deprecated .但是,在我的代码中,我创建了一个 InAppPurchase 类,在我控制购买方式的方法中,我在我的代码中使用了委托(delegate)方法,它就像:

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {

for (SKPaymentTransaction *transaction in transactions) {

switch (transaction.transactionState) {

case SKPaymentTransactionStatePurchasing:

// code and bla bla bla
[self initPurchase];
NSLog(@"PASO 1");

break;

case SKPaymentTransactionStatePurchased:

// this is successfully purchased!
purchased = TRUE;
NSLog(@"PASO 2");
[self isPurchased];

NSLog(@"purchased %s", purchased? "true" : "false");

// and return the transaction data

if ([delegate respondsToSelector:@selector(successfulPurchase:restored:identifier:receipt:)])
[delegate successfulPurchase:self restored:NO identifier:transaction.payment.productIdentifier receipt:transaction.transactionReceipt];

// and more code bla bla bla

break;

case SKPaymentTransactionStateRestored:

// and more code bla bla bla

[self restorePurchase];
NSLog(@"PASO 3");

break;

case SKPaymentTransactionStateFailed:

// and more code bla bla bla

[self failedNotification];
NSLog(@"PASO 4");

break;

//------------------------------------------//
// THANKS GUYS //
// GRETTINGS FROM BOLIVIA //
// ROCK ON!!!! n_n' //
//------------------------------------------//

}
}
}

enter image description here

最佳答案

您可以将收据作为 mainBundle 的 appStoreReceiptURL 的内容获取。您可以找到引用资料:developer.apple.com

这是未经测试的代码,但在我的脑海中,我会说一些类似的话:

[NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]]

应该让您得到与 transactionReceipt 过去返回的相同的结果。

关于objective-c - iOS 7 已弃用用于应用内购买的 transactionReceipt。我可以用什么代替它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18903879/

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