下载此文档

iOS开发之购买支付.doc


文档分类:IT计算机 | 页数:约3页 举报非法文档有奖
1/3
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/3 下载此文档
文档列表 文档介绍
扣丁学堂,智悦分享
如上图所示,是支付的一个完整的流程,接下来我会为大家详细剖析。
1、首先验证是否能够支付
- (BOOL)checkCanMakePayment
{
if ([SKPaymentQueue canMakePayments]) {
return YES;
} else {
return NO;
}
}
2、其次获取需要支付商品信息
- (void)purchaseProductWithIndentifier:(NSString *)identifier
{
if (identifier == nil || [@"" isEqualToString:identifier]) {
if ( && [ respondsToSelector:***@selector(ess:)]
{
[ ess:identifier];
}
return;
}
[[ITTActivityIndicator currentIndicator] displayActivity:@"获取商品信息中..."];
SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:identifier]];
= self;
[request start];
}
3、接收来自App Store的回应
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
[[ITTActivityIndicator currentIndicator] hide];
NSArray *myProducts = ;
// Populate your UI from the products
// Save a reference to the products list.
if (myProducts && [myProducts count] > 0) {
SKProduct *selectedProduct = [myProducts objectAtIndex:0];
SKPayment *payment = [SKPayment paymentWithProduct:selectedProduct];
[[SKPaymentQueue defaultQueue] addPayment:payment];
}
else {
[[ITTActivityIndicator currentIndicator] displayActivity:@"获取商品信息失败!"];
}
}
4、对支付进行相应的处理
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTr

iOS开发之购买支付 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数3
  • 收藏数0 收藏
  • 顶次数0
  • 上传人zhangbing32159
  • 文件大小0 KB
  • 时间2015-06-27
最近更新