简体   繁体   English

如何截获StoreKit的“购买对话框”以使MBProgressHUD / UIProgressView正确并在正确的时间显示?

[英]How can I intercept the StoreKit “buy dialog” to make a MBProgressHUD / UIProgressView show up correctly and at the right times?

I'm programming StoreKit into my iPhone app. 我正在将StoreKit编程到我的iPhone应用程序中。 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? 另外,如果我不展示商店,而只是一个可预测的商品,我是否需要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. 最后一件事:在-(void)paymentQueue:(SKPaymentQueue *)队列updatedTransactions:(NSArray *)transactions方法中,如果我显示了一个AlertView如果满足情况SKPaymentTransactionStateFailed :,即使购买了商品,我也会继续收到多个电话完成一次。

Thanks! 谢谢!

Please help with anything you can (just trying to learn my iPhone programming). 请提供所有可能的帮助(只是尝试学习我的iPhone编程)。

For your first question on an Activity View during the processing slow stretches. 对于在缓慢处理过程中在“活动视图”上遇到的第一个问题。

You can intercept the "SKPaymentTransactionStatePurchasing state in the Payment Queue to put up an Alert View with an activity Indicator. Dismiss the View in the Purchased, Restored and Failed states after you have completed your processing. The StoreKit generated AlertViews will make this one disappear and re-appear as required throughout the process. 您可以在“支付队列”中拦截“ SKPaymentTransactionStatePurchasing状态”,以创建带有活动指示器的警报视图。完成处理后,在“已购买”,“已还原”和“失败”状态下关闭该视图。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;

For the 2nd question, I kickoff the load of my store items at app startup time so they are ready by the time the user gets to the store. 对于第二个问题,我在应用启动时启动了商店商品的加载,以便在用户进入商店时就可以准备好它们。 Since they load async, they should be ready by the time a user get to a store view. 由于它们加载异步,因此应在用户进入商店视图时准备就绪。

Not sure on the last question. 不确定最后一个问题。

Steve 史蒂夫

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM