2012-07-12 20 views
0

我現在有我的應用程序內購買「恢復」按鈕,在沒有「購買」提示的情況下恢復應用內購買?可能嗎?

確實工作,但本質上它要求用戶中旬方式經由過程「買入」升級(就像它會對一個正常的應用程序內),我擔心這會

一)蘋果 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]; 
} 

回答

1

絕對有可能,事實上它是必要的。看到我的answer有點類似question

本質上,當您按下還原按鈕時,應該要求用戶驗證其帳戶;這是由StoreKit處理。如果爲該賬戶找到了購買物品,那麼該流程應該以與他們第一次購買該物品相同的方式開始恢復購買,而沒有實際購買的提示。

+0

您好,感謝您的回答,我必須承認,我奮力把它的那一刻,它的令人沮喪的這樣一個小功能添加代碼! 那麼你會建議用你的代碼替換上面的代碼嗎?或者你可以幫助修改我的代碼? 親切的問候 Agnelli – Agnelli 2012-07-13 00:18:35

+1

不幸的是,你將不得不用這裏給出的幫助來解決這個問題。你還期望學習SDK,以及如何正確地把事情放在一起並使它們工作?如果你**看不出來,請查看我的個人資料以獲得進一步的幫助。 – WrightsCS 2012-07-13 00:22:36

0

我看到你正在使用MKStoreKit。只需在您的應用程序中啓用iCloud,然後MKStoreKit負責其餘部分。其他設備會在沒有打開商店頁面的情況下將「購買」視爲「已購買」。

PS:我寫MKStoreKit