IAPHandler 是一款轻量级用于应用内购买的辅助框架。
/// 第一次购买
[[IAPHandler shareIAPHandlerWithProductId:@"InAppPurcharse's ID"] buyProductWithResponse:^(NSError *error) {
if (error == nil) {
NSLog(@"内购成功");
} else {
NSLog(@"内购失败,错误原因为 %@", [error localizedDescription]);
}
}];
/// 恢复购买
[[IAPHandler shareIAPHandlerWithProductId:@"InAppPurcharse's ID"] restoreProductWithResponse:^(NSError *error) {
if (error == nil) {
NSLog(@"内购成功");
} else {
NSLog(@"恢复内购失败,错误原因为 %@", [error localizedDescription]);
}
}];
- iOS 6.0 +
pod 'IAPHandler', '~> 0.9.0'