1717
1818PF_ASSUME_NONNULL_BEGIN
1919
20+ typedef void (^PFPurchaseProductObservationBlock)(SKPaymentTransaction *transaction);
21+ typedef void (^PFPurchaseBuyProductResultBlock)(NSError *PF_NULLABLE_S error);
22+ typedef void (^PFPurchaseDownloadAssetResultBlock)(NSString *PF_NULLABLE_S filePath, NSError *PF_NULLABLE_S error);
23+
2024/* !
2125 `PFPurchase` provides a set of APIs for working with in-app purchases.
2226
@@ -35,16 +39,15 @@ PF_ASSUME_NONNULL_BEGIN
3539 @param productIdentifier the product identifier
3640 @param block The block to be run when buying a product.
3741 */
38- + (void )addObserverForProduct : (NSString *)productIdentifier
39- block : (void (^)(SKPaymentTransaction *transaction))block ;
42+ + (void )addObserverForProduct : (NSString *)productIdentifier block : (PFPurchaseProductObservationBlock)block ;
4043
4144/* !
4245 @abstract *Asynchronously* initiates the purchase for the product.
4346
4447 @param productIdentifier the product identifier
4548 @param block the completion block.
4649 */
47- + (void )buyProduct : (NSString *)productIdentifier block : (void (^)( NSError *error) )block ;
50+ + (void )buyProduct : (NSString *)productIdentifier block : (PFPurchaseBuyProductResultBlock )block ;
4851
4952/* !
5053 @abstract *Asynchronously* download the purchased asset, which is stored on Parse's server.
@@ -55,7 +58,7 @@ PF_ASSUME_NONNULL_BEGIN
5558 @param completion the completion block.
5659 */
5760+ (void )downloadAssetForTransaction : (SKPaymentTransaction *)transaction
58- completion : (void (^)( NSString *filePath, NSError *error) )completion ;
61+ completion : (PFPurchaseDownloadAssetResultBlock )completion ;
5962
6063/* !
6164 @abstract *Asynchronously* download the purchased asset, which is stored on Parse's server.
@@ -67,7 +70,7 @@ PF_ASSUME_NONNULL_BEGIN
6770 @param progress the progress block, which is called multiple times to reveal progress of the download.
6871 */
6972+ (void )downloadAssetForTransaction : (SKPaymentTransaction *)transaction
70- completion : (void (^)( NSString *filePath, NSError *error) )completion
73+ completion : (PFPurchaseDownloadAssetResultBlock )completion
7174 progress : (PF_NULLABLE PFProgressBlock)progress ;
7275
7376/* !
0 commit comments