OkayIAPManager 0.3.0

OkayIAPManager 0.3.0

CoderGL 维护。



  • 张国良

OkayIAPManager

CI Status Version License Platform

简介

这是一个简单的应用内购买库。要运行示例项目,克隆仓库,并首先从示例目录中运行 pod install

要求

iOS 8.0 或更高版本。

安装

OkayIAPManager 可通过 CocoaPods 获得。要安装它,只需将以下行添加到您的Podfile中

pod 'OkayIAPManager'

用法

/// start purchase
- (IBAction)action:(id)sender {
    
    [[OkayIAPManager shareInstance] startPurchWithProductId:@"cn.okay.IAPurch_1" orderId:@"xxx" completeHandle:^(OkayIAPurchType type, NSString *orderId, NSData *data, SKPaymentTransaction *transaction) {
        
    }];
}


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    /// check drop order
    [[OkayIAPManager shareInstance] checkLoseIAPOrderCallBack:^(OkayIAPurchType type, NSString *order, NSData *data) {
        if (type == OkayIAPurchTypeSuccess) {
            /// simulate verify purchase result at your servers.
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                /// must be removeCurrentTransaction in the end.
                [[OkayIAPManager shareInstance] removeCurrentTransaction];
            });
        }
    }];
    
    return YES;
}

作者

张国梁, [email protected]

许可

OkayIAPManager遵循MIT许可。有关更多信息,请参阅LICENSE文件。