我继承了 SKPaymentTransaction(例如 MutableSKPaymentTransaction),覆盖了只读参数。已经有一个可变的 SKPaymentTransaction,您可以使用它,或者您可以以类似的方式覆盖 SKPayment。
例子:
在头文件(MutableSKPaymentTransaction.h)文件中
#import <StoreKit/StoreKit.h>
@interface MutableSKPaymentTransaction : SKPaymentTransaction
@property (readwrite, copy, nonatomic) NSError * error;
@property (readwrite, copy, nonatomic) SKPayment * payment;
@property (readwrite, copy, nonatomic) NSString * transactionIdentifier;
@property (readwrite, copy, nonatomic) NSDate * transactionDate;
@property (readwrite, copy, nonatomic) NSArray * downloads;
@property (readwrite, copy, nonatomic) SKPaymentTransaction *originalTransaction;
@property (assign, nonatomic) SKPaymentTransactionState transactionState;
@end
在方法文件(MutableSKPaymentTransaction.m)中:
#import "MutableSKPaymentTransaction.h"
@implementation MutableSKPaymentTransaction
// readonly override
@synthesize error = _error;
@synthesize payment = _payment;
@synthesize transactionIdentifier = _transactionIdentifier;
@synthesize transactionDate = _transactionDate;
@synthesize downloads = _downloads;
@synthesize originalTransaction = _originalTransaction;
@synthesize transactionState = _transactionState;
@end