我正在使用已弃用的 API,并且我想更新我的代码以使用非弃用的代码。
所以我最大的问题是如何获得回复列表?
- (void) buyFeature:(NSString*) featureId
{
// SKProduct *myProduct;
if ([SKPaymentQueue canMakePayments])
{
SKPayment *payment = [SKPayment paymentWithProductIdentifier:featureId];
// SKPayment *payment = [SKPayment paymentWithProduct:myProduct];
[[SKPaymentQueue defaultQueue] addPayment:payment];
}
else
{
[[NSNotificationCenter defaultCenter] postNotificationName:@"purchaseDone" object:nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"You are not authorized to purchase from AppStore"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
}
- (void) purchase: (int) productIndex {
[self buyFeature: [aryProductIDs objectAtIndex: productIndex]];
}
aryProductIDs 在 (id)init 下定义
aryProductIDs = [[NSMutableArray alloc] initWithObjects: @"iap_100OrangeDollars",
@"iap_1",
@"iap_2",
@"iap_1month",
@"iap_3month",
@"iap_6month",
@"iap_12month",
@"iap_1lifetime",
nil];
我不确定 myProduct(SKProduct 类型)使用什么。
我见过很多使用 NSSet 而不是 NSMutableArray 的例子。不确定我是否需要更改它