In-App Purchases功能ECPurchase-ios
在程序中,我们可以使用IOS内置库StoreKit.framework里提供的Api实现In-App Purchases产品的购买功能。但如果你不想根据文档再自己写purchase功能,那么有一个第三方的库ECPurchase会适合你。 ECPurchase库封装了purchase的内在逻辑,并且提供了几种验证方式(用于防止iap破解),调用简单方便。ECPurchase库可在文章后面我提供的例子里获得。ECPurchase提供了下面的接口需要开发者自己完成:
- [[ECPurchase shared] addTransactionObserver];
- [[ECPurchase shared] setProductDelegate:self];
- [[ECPurchase shared] setTransactionDelegate:self];
- [[ECPurchase shared] setVerifyRecepitMode:ECVerifyRecepitModeiPhone];
- [[ECPurchase shared] requestProductData:identifiers];
- [[ECPurchase shared] requestProductData:identifiers];
- [[ECPurchase shared] addPayment:proIdentifier];
- -(void)didFailedTransaction:(NSString *)proIdentifier;
- -(void)didRestoreTransaction:(NSString *)proIdentifier;
- -(void)didCompleteTransaction:(NSString *)proIdentifier;
- -(void)didCompleteTransactionAndVerifySucceed:(NSString *)proIdentifier;
- -(void)didCompleteTransactionAndVerifyFailed:(NSString *)proIdentifier withError:(NSString *)error;
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。