有没有办法通过用另一个应用程序替换应用程序来处理iphone应用内购买?

时间:2013-02-08 05:59:21

标签: iphone objective-c in-app-purchase

我最近开始研究如何将应用内购买添加到iphone应用程序中,并且我使用产品标识符找到了Store Kit方法(请参阅此处:http://www.raywenderlich.com/2797/introduction-to-in-app-purchases)。但是,如果不是看得太远,这个过程看起来比我希望的更长,更乏味。

是否可以通过简单地将应用程序的代码复制到新文件中,将其他内容添加到该文件中,然后让应用内购买只是“切换”2个版本来实现应用内购买?

1 个答案:

答案 0 :(得分:1)

框架的想法当然允许你使用像黑盒子一样的东西。所以答案是肯定的。让我指导你。

  1. 复制并导入项目源但忽略InAppRageIAPHelper.m
  2. 在您自己的应用代理或控制器中,执行

    @interface YourAppDelegate:IAPHelper {

  3. 然后

    - (id)init { 
        NSSet *productIdentifiers = [NSSet setWithObjects:
             @"your product id",
        nil];
    
    if ((self = [super initWithProductIdentifiers:productIdentifiers])) {                
    
    }
    return self;
    

    }

    现在您可以使用[self requestProducts]请求产品。当您收到 - (void)productsLoaded:(NSNotification *)通知时,您的产品会被加载。