我需要将此字符串方法更改为SKProduct
对象,因为它在我的应用程序(ios 5)上已弃用
(注意:这是在 InAppRageIAPHelper 类上实现的)
- (void)buyProductIdentifier2:(NSString *)productIdentifier {
srtProduct = [productIdentifier copy];
NSLog(@"Buying %@...", productIdentifier);
SKPayment *payment = [SKPayment paymentWithProductIdentifier:productIdentifier];
[[SKPaymentQueue defaultQueue] addPayment:payment];
}
然后,当您点击购买时:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(alertView.tag == 1)
{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if([title isEqualToString:@"Cancel"])
{
if ([delegate respondsToSelector:@selector(purchaseCancelled)]) {
[delegate purchaseCancelled];
}
}
else if([title isEqualToString:@"Buy"])
{
[self buyProductIdentifier2:srtProduct];
}
}
}
有人可以解释我要改变什么吗?