---
title: "ios内付费"
author: "374016526"
date: "2015-07-14T16:15:59Z"
tags: ["iOS"]
categories: ["移动开发"]
slug: "ios"
draft: false
lastmod: "2015-07-14T18:11:53Z"
id: 2227256
url: "https://374016526.iteye.com/blog/2227256"
---

近年来写了很多IOS的程序，内付费也用到不少，使用IOS的内付费实现起来比较麻烦，这里我写了一个简单的内付费包，希望对大家有帮助。

 

具体使用如下:

这里的sender其实就是调用者，这里主要是为了回调使用。

[KuroStoreApi kuroStoreProductId:@"产品ID" storeSender:self storeFinishCallBackBlock:^(KuroStoreApiProductState state, NSData \*transactionReceipt, id sender) {

        

        if (state == KuroStoreApiProductStateFailed) {

            NSString \*res = \[NSString stringWithUTF8String:\[transactionReceipt bytes]];

            NSLog(@"失败..... %@",res);

            \[sender showResult:res];

        } else if (state == KuroStoreApiProductStatePurchased) {

            NSLog(@"成功.....");

            \[sender showResult:nil];

        } else if (state == KuroStoreApiProductStateRestored) {

            NSLog(@"恢复.....");

            \[sender showResult:nil];

        }

        

        

        //                NSLog(@"KuroStoreApiProductState  %d",state);

        

        

 

    }];