0

I'm programming StoreKit into my iPhone app. I can't seem to be able to intercept the buy item dialog wait time either before or after pressing the button to purchase the item. Pretty much what I want is an indicator on the screen before the buy dialog appears and after, but before the purchased item is unlocked. I don't want my users being hung up on the screen, not knowing if their purchase went through.

Also, if I'm not displaying a store, just one predictable item, do I need to requestProductData? Anything to make the wait time as less as possible would be good.

One last thing: In the - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions method, if I show an alertView if the case SKPaymentTransactionStateFailed: is fulfilled, I keep on getting multiple calls, even if the purchase is done once.

Thanks!

Please help with anything you can (just trying to learn my iPhone programming).

4

1 回答 1

4

对于您在处理缓慢的过程中关于活动视图的第一个问题。

您可以在 Payment Queue 中截取“SKPaymentTransactionStatePurchasing 状态以建立一个带有活动指示符的 Alert View。在您完成处理后关闭处于 Purchased、Restored 和 Failed 状态的 View。StoreKit 生成的 AlertViews 将使这个消失并在整个过程中根据需要重新出现。

case SKPaymentTransactionStatePurchasing:
                purchaseActivityIndicator = [[UIAlertView alloc] initWithTitle:@"Processing purchase" message:@"Please wait..." delegate:self cancelButtonTitle:nil otherButtonTitles:nil,nil];
                UIActivityIndicatorView *activity = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
                [activity setFrame:CGRectMake(121.0f, 80.0f, 36.0f, 36.0f)];
                [purchaseActivityIndicator addSubview:activity];
                [activity startAnimating];
                [activity release];
                [purchaseActivityIndicator show];
                [purchaseActivityIndicator release];
                break;

对于第二个问题,我在应用程序启动时启动商店项目的加载,以便在用户到达商店时准备好它们。由于它们是异步加载的,因此它们应该在用户进入商店视图时准备就绪。

不确定最后一个问题。

史蒂夫

于 2010-07-11T07:41:55.207 回答