ios内付费

近年来写了很多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);

        

        

    }];

猜你喜欢

转载自374016526.iteye.com/blog/2227256