在没有“购买”提示的情况下恢复应用内购买?可能吗?

时间:2012-07-12 23:56:44

标签: iphone ios xcode in-app-purchase storekit

我目前有应用内购买“恢复”按钮,

工作,但基本上它要求用户在整个过程中“购买”升级(就像在正常的应用程序中一样)我担心这会< / p>

a)被苹果拒绝 b)吓唬用户认为他们再次付款

我有什么办法可以改变它,所以它可能有不同的信息吗?

-(IBAction)restore:(id)sender
{=
    [[SKPaymentQueue defaultQueue]
     addTransactionObserver:self];
    [[SKPaymentQueue defaultQueue]
     restoreCompletedTransactions];

    UIAlertView *alert;

    alert = [[[UIAlertView alloc] initWithTitle:@"Restoring Your Purchases, Please Wait..." message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil] autorelease];
    [alert show];

    UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];

    // Adjust the indicator so it is up a few pixels from the bottom of the alert
    indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50);
    [indicator startAnimating];
    [alert addSubview:indicator];
    [indicator release];

    [alert dismissWithClickedButtonIndex:0 animated:YES];

    [[MKStoreManager sharedManager] buyFeature];=
}

-(void)productPurchased
{
    for (UIView *view in self.view.subviews)
    {
        if (view.tag==2000)
        {
            [view removeFromSuperview];
        }
    } 

    UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Thank you" message:@"Your restore was successful." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
    [alert show];
    [alert release];
}

// error restore
- (void)failed
{
    for (UIView *view in self.view.subviews)
    {
        if (view.tag==2000)
        {
            [view removeFromSuperview];
        }
    }

    UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Error" message:@"Your restore has failed." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
    [alert show];
    [alert release];
}

2 个答案:

答案 0 :(得分:1)

绝对有可能,事实上它是必要的。看到我的answer有点类似question

基本上,当您按下恢复按钮时,系统会要求用户验证其帐户;这由StoreKit处理。如果找到该帐户的IA购买,则该过程应该开始恢复购买,就像他们第一次购买该商品一样,只是没有实际购买的提示。

答案 1 :(得分:0)

我看到你正在使用MKStoreKit。只需在您的应用中启用iCloud,MKStoreKit即可完成其余工作。其他设备将“看到”购买“买”,甚至没有打开商店页面。

PS:我写了MKStoreKit